Hidistro.UI.Web/UploadHandler.cs
(开头部分) 3KB这里只显示每个文件的开头 60 行。登录后可以解锁完整代码。
using System;
using System.IO;
using System.Linq;
using System.Runtime.CompilerServices;
using System.Web;
public class UploadHandler : Handler
{
public UploadHandler(HttpContext context, UploadConfig config) : base(context)
{
this.UploadConfig = config;
UploadResult result = new UploadResult {
State = UploadState.Unknown
};
this.Result = result;
}
private bool CheckFileSize(int size)
{
return (size < this.UploadConfig.SizeLimit);
}
private bool CheckFileType(string filename)
{
string str = Path.GetExtension(filename).ToLower();
return (from x in this.UploadConfig.AllowExtensions select x.ToLower()).Contains<string>(str);
}
private string GetStateMessage(UploadState state)
{
switch (state)
{
case UploadState.NetworkError:
return "网络错误";
case UploadState.FileAccessError:
return "文件访问出错,请检查写入权限";
case UploadState.TypeNotAllow:
return "不允许的文件格式";
case UploadState.SizeLimitExceed:
return "文件大小超出服务器限制";
case UploadState.Success:
return "SUCCESS";
}
return "未知错误";
}
public override void Process()
{
byte[] buffer = null;
string filename = null;
if (this.UploadConfig.Base64)
{
filename = this.UploadConfig.Base64Filename;
buffer = Convert.FromBase64String(base.Request[this.UploadConfig.UploadFieldName]);
}
else
后面还有 60 行代码,购买后查看完整代码
24 小时内免费解锁 3 个项目,之后 1 算力/个。 规则说明
AI 解读 AI
登录后可用,每次 10 算力,解读结果公开显示在下面。
还没有人解读过这个文件。
