wxxsd/wxxsd123/UEditor/net/imageUp.ashx
(开头部分) 2KB这里只显示每个文件的开头 60 行。登录后可以解锁完整代码。
<%@ WebHandler Language="C#" Class="imageUp" %>
using System;
using System.Web;
using System.IO;
public class imageUp : IHttpHandler{
public void ProcessRequest(HttpContext context){
context.Response.ContentType = "text/plain";
//上传配置
String pathbase = "~/UploadFiles/AdminUpload/"; //保存路径
string[] filetype = { ".gif", ".png", ".jpg", ".jpeg", ".bmp" }; //文件允许格式
int size = 1024; //文件大小限制,单位KB
//文件上传状态,初始默认成功,可选参数{"SUCCESS","ERROR","SIZE","TYPE"}
String state = "SUCCESS";
String title = String.Empty;
String oriName = String.Empty;
String filename = String.Empty;
String url = String.Empty;
String currentType = String.Empty;
String uploadpath = String.Empty;
uploadpath = context.Server.MapPath(pathbase);
try{
HttpPostedFile uploadFile = context.Request.Files[0];
title = uploadFile.FileName;
//目录验证
if (!Directory.Exists(uploadpath)){
Directory.CreateDirectory(uploadpath);
}
//格式验证
string[] temp=uploadFile.FileName.Split('.');
currentType = "."+ temp[temp.Length - 1].ToLower();
if (Array.IndexOf(filetype, currentType)==-1){
state = "TYPE";
}
//大小验证
if( uploadFile.ContentLength/1024>size){
state="SIZE";
}
//保存图片
if (state=="SUCCESS"){
filename = DateTime.Now.ToString("yyyy-MM-dd-ss") + System.Guid.NewGuid() + currentType;
uploadFile.SaveAs(uploadpath + filename);
url = "/UploadFiles/AdminUpload/" + filename;
}
}catch (Exception){
state = "ERROR";
}
//获取图片描述
if (context.Request.Form["pictitle"] != null){
后面还有 24 行代码,购买后查看完整代码
24 小时内免费解锁 3 个项目,之后 1 积分/个。 规则说明
AI 解读
登录后可用,每次 10 积分,解读结果公开显示在下面。
还没有人解读过这个文件。
