2023-08-04
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
using Newtonsoft.Json.Linq;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Web;
|
||||
using System.Web.SessionState;
|
||||
@@ -41,6 +42,8 @@ namespace FineUIPro.Web.AttachFile
|
||||
ResponseError(context);
|
||||
return;
|
||||
}
|
||||
// 定义允许上传的文件类型列表
|
||||
List<string> allowExtensions = BLL.DropListService.allowExtensions;
|
||||
|
||||
HttpPostedFile postedFile = context.Request.Files[0];
|
||||
// 文件名完整路径
|
||||
@@ -51,6 +54,15 @@ namespace FineUIPro.Web.AttachFile
|
||||
|
||||
string shortFileName = GetFileName(fileName);
|
||||
string fileType = GetFileType(fileName);
|
||||
if (!allowExtensions.Contains("." + fileType))
|
||||
{
|
||||
// 出错了
|
||||
context.Response.StatusCode = 415;
|
||||
context.Response.Write("不支持的文件类型");
|
||||
// ResponseError(context);
|
||||
|
||||
return;
|
||||
}
|
||||
int fileSize = postedFile.ContentLength;
|
||||
|
||||
JObject fileObj = new JObject();
|
||||
|
||||
Reference in New Issue
Block a user