改新活动
This commit is contained in:
16
pkg/util/util.go
Normal file
16
pkg/util/util.go
Normal file
@@ -0,0 +1,16 @@
|
||||
package util
|
||||
|
||||
import (
|
||||
"errors"
|
||||
"path/filepath"
|
||||
)
|
||||
|
||||
func ValidateFilename(filename string) error {
|
||||
switch filepath.Ext(filename) {
|
||||
case ".pdf", ".doc", ".jpg", ".gif", ".png", ".jpeg",
|
||||
".docx", ".xls", ".xlsx", ".zip", ".rar", ".7z":
|
||||
return nil
|
||||
default:
|
||||
return errors.New("扩展名不支持")
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user