Browse Source

文件后缀名

layui
mail_yanpeng@163.com 5 years ago
parent
commit
f053b8721f
  1. 5
      controllers/FileController.go

5
controllers/FileController.go

@ -32,8 +32,11 @@ func (this *FileController) Upload() {
var AllowExtMap map[string]bool = map[string]bool{
".jpg": true,
".jpeg": true,
".png": true,
".gif": true,
".png": true,
".GIF": true,
".JPG": true,
".PNG": true,
}
if _, ok := AllowExtMap[ext]; !ok {
this.Data["json"] = models.ReurnError(500, "后缀名不符合上传要求")

Loading…
Cancel
Save