Web/ajax/up_logo.ashx.cs

(完整代码) 1KB

using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;

namespace Maticsoft.Web.ajax
{
    /// <summary>
    /// up_logo 的摘要说明
    /// </summary>
    public class up_logo : IHttpHandler
    {

        public void ProcessRequest(HttpContext context)
        {
            context.Response.ContentType = "text/plain";
            string filename = DateTime.Now.ToString("yyyyMMddHHmmss") + Maticsoft.Common.Input.BuildRandomStr(4) + ".jpg";
            HttpPostedFile postFile = context.Request.Files[0];//httpPostFile
            if (postFile.ContentLength == 0)
            {
                context.Response.Write("");

            }
            else
            {
                string mapPathDir = "~/UploadFile/logo/";
                if (System.IO.Directory.Exists(context.Server.MapPath(mapPathDir)) != true)
                {
                    System.IO.Directory.CreateDirectory(context.Server.MapPath(mapPathDir));
                }
                postFile.SaveAs(context.Server.MapPath(mapPathDir + filename));
                context.Response.Write(filename);
                //context.Response.Write("1");  

            }
        }

        public bool IsReusable
        {
            get
            {
                return false;
            }
        }
    }
}

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

AI 解读

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

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