Content/Tools/SingleUpload.ashx
(开头部分) 2KB这里只显示每个文件的开头 60 行。登录后可以解锁完整代码。
<%@ WebHandler Language="C#" Class="SingleUpload" %>
using System;
using System.Collections;
using System.Data;
using System.Web;
using System.Web.Services;
using System.Web.Services.Protocols;
using System.Web.SessionState;
using System.IO;
/// <summary>
/// AJAX单文件上传页
/// </summary>
public class SingleUpload : IHttpHandler, IRequiresSessionState
{
public void ProcessRequest(HttpContext context)
{
//检查是否登录后上传操作
if (!new AdminBase().IsAdminLogin())
{
context.Response.Write("{msg: 0, msbox: \"请登录后再进行上传文件!\"}");
return;
}
string _refilepath = context.Request.QueryString["ReFilePath"]; //取得返回的对象名称
string _upfilepath = context.Request.QueryString["UpFilePath"]; //取得上传的对象名称
int _iswater; //默认打水印
if (!int.TryParse(context.Request.QueryString["IsWater"] as string, out _iswater))
{
_iswater = 1;
}
HttpPostedFile _upfile = context.Request.Files[_upfilepath];
string _delfile = context.Request.Params[_refilepath];
if (_upfile == null)
{
context.Response.Write("{\"msg\": 1, \"msbox\": \"请选择要上传文件!\"}");
return;
}
UpLoad upFiles = new UpLoad();
string msg = upFiles.fileSaveAs(_upfile, _iswater);
//删除已存在的旧文件
//if (!string.IsNullOrEmpty(_delfile))
//{
// string _filename = Utils.GetMapPath(_delfile);
// if (File.Exists(_filename))
// {
// File.Delete(_filename);
// }
//}
//返回成功信息
context.Response.Write(msg);
}
public bool IsReusable
{
get
{
return false;
}
后面还有 3 行代码,解锁后查看完整代码
24 小时内免费解锁 3 个项目,之后 1 积分/个。 规则说明
AI 解读
登录后可用,每次 10 积分,解读结果公开显示在下面。
还没有人解读过这个文件。
