Browse Source

研报上传添加pdf类型

xyxie 10 months ago
parent
commit
f5663002e8
1 changed files with 5 additions and 2 deletions
  1. 5 2
      controllers/report.go

+ 5 - 2
controllers/report.go

@@ -1286,8 +1286,11 @@ func (this *ReportUploadCommonController) UploadImg() {
 	}
 	pass := filetype.IsImage(fileData)
 	if !pass {
-		err = fmt.Errorf("文件格式有误")
-		return
+		kind, _ := filetype.Match(fileData)
+		if kind.Extension != "pdf" {
+			err = fmt.Errorf("文件格式有误")
+			return
+		}
 	}
 
 	ext := path.Ext(h.Filename)