|
@@ -1010,8 +1010,11 @@ func (this *ResourceController) ResourceUpload() {
|
|
|
br.ErrMsg = "读取文件失败, Err: " + e.Error()
|
|
|
return
|
|
|
}
|
|
|
+ ext := path.Ext(h.Filename)
|
|
|
+ //fmt.Println("ext", ext)
|
|
|
kind, _ := filetype.Match(fileData)
|
|
|
- if kind.Extension != "pdf" && kind.Extension != "ppt" && kind.Extension != "pptx" && kind.Extension != "docx" && kind.Extension != "doc" {
|
|
|
+ //fmt.Println("kind.Extension", kind.Extension)
|
|
|
+ if ext != ".pdf" && ext != ".ppt" && ext != ".pptx" && ext != ".docx" && ext != ".doc" && kind.Extension != "pdf" && kind.Extension != "ppt" && kind.Extension != "pptx" && kind.Extension != "docx" && kind.Extension != "doc" {
|
|
|
br.Msg = "文件格式有误"
|
|
|
return
|
|
|
}
|
|
@@ -1022,7 +1025,7 @@ func (this *ResourceController) ResourceUpload() {
|
|
|
br.ErrMsg = "存储目录创建失败, Err:" + e.Error()
|
|
|
return
|
|
|
}
|
|
|
- ext := path.Ext(h.Filename)
|
|
|
+
|
|
|
ossFileName := utils.GetRandStringNoSpecialChar(28) + ext
|
|
|
filePath := uploadDir + "/" + ossFileName
|
|
|
if e = this.SaveToFile("File", filePath); e != nil {
|