Web/Managers/depend/UploadHandler.ashx.cs

(开头部分) 2KB

这里只显示每个文件的开头 60 行。登录后可以解锁完整代码。

using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using Bll;
using System.Configuration;
using System.IO;
using Common;

namespace Web.Managers.depend
{
    /// <summary>
    /// UploadHandler 的摘要说明
    /// </summary>
    public class UploadHandler : IHttpHandler
    {

        public void ProcessRequest(HttpContext context)
        {
            context.Response.ContentType = "text/plain";
            context.Response.Charset = "utf-8";
            if (BAdmin.CheckAdminLogin() == null)
            {
                context.Response.Write("error!");
            }
            else
            {
                try
                {
                    HttpPostedFile file = context.Request.Files["Filedata"];
                    string uploadPath = HttpContext.Current.Server.MapPath(context.Request["folder"]);
                    if (file != null)
                    {
                        int contentLength = file.ContentLength;
                        ConfigurationManager.AppSettings["uploadFile"].ToString();
                        string fileType = file.FileName.Substring(file.FileName.LastIndexOf('.'));
                        if (!Directory.Exists(uploadPath))
                        {
                            Directory.CreateDirectory(uploadPath);
                        }
                        string fileName = Funs.rndTimeStr() + fileType;
                        string absolutePath = uploadPath + fileName;
                        file.SaveAs(absolutePath);
                        ImageWater.AddPhotoWater(absolutePath, HttpContext.Current.Server.MapPath("../../images/") + "logo.png");
                        context.Response.Write(fileName);
                        context.Response.StatusCode = 200;
                    }
                }
                catch
                {
                    context.Response.Write("error!");
                }
            }
        }

        public bool IsReusable
        {
            get
            {
                return false;
后面还有 4 行代码,解锁后查看完整代码

24 小时内免费解锁 3 个项目,之后 1 积分/个。 规则说明

AI 解读

登录后可用,每次 10 积分,解读结果公开显示在下面。

还没有人解读过这个文件。