ImageUpload.cs
(开头部分) 16KB这里只显示每个文件的开头 60 行。登录后可以解锁完整代码。
using System;
using System.IO;
using System.Web;
using System.Web.UI.HtmlControls;
using System.Drawing;
/// <summary>
/// 文件类型
/// </summary>
public enum FileExtension
{
JPG = 255216,
GIF = 7173,
BMP = 6677,
PNG = 13780,
RAR = 8297,
jpg = 255216,
exe = 7790,
xml = 6063,
html = 6033,
aspx = 239187,
cs = 117115,
js = 119105,
txt = 210187,
sql = 255254
}
/// <summary>
/// 图片检测类
/// </summary>
public static class FileValidation
{
#region 上传图片检测类
/// <summary>
/// 是否允许
/// </summary>
public static bool IsAllowedExtension(HttpPostedFile oFile, FileExtension[] fileEx)
{
int fileLen = oFile.ContentLength;
byte[] imgArray = new byte[fileLen];
oFile.InputStream.Read(imgArray, 0, fileLen);
MemoryStream ms = new MemoryStream(imgArray);
System.IO.BinaryReader br = new System.IO.BinaryReader(ms);
string fileclass = "";
byte buffer;
try
{
buffer = br.ReadByte();
fileclass = buffer.ToString();
buffer = br.ReadByte();
fileclass += buffer.ToString();
}
catch { }
br.Close();
ms.Close();
foreach (FileExtension fe in fileEx)
{
if (Int32.Parse(fileclass) == (int)fe) return true;
}
return false;
后面还有 505 行代码,解锁后查看完整代码
24 小时内免费解锁 3 个项目,之后 1 算力/个。 规则说明
AI 解读 AI
登录后可用,每次 10 算力,解读结果公开显示在下面。
还没有人解读过这个文件。