Hidistro.UI.Web/Admin/UploadHandler.cs

(开头部分) 2KB

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

namespace Hidistro.UI.Web.Admin
{
    using Hidistro.Core;
    using System;
    using System.Globalization;
    using System.IO;
    using System.Web;

    public class UploadHandler : IHttpHandler
    {
        private void DeleteImage()
        {
            string path = HttpContext.Current.Request.Form["del"];
            string str2 = Globals.PhysicalPath(path);
            try
            {
                if (File.Exists(str2))
                {
                    File.Delete(str2);
                    HttpContext.Current.Response.Write("true");
                }
            }
            catch (Exception)
            {
                HttpContext.Current.Response.Write("false");
            }
        }

        public void ProcessRequest(HttpContext context)
        {
            context.Response.ContentType = "text/plain";
            switch (context.Request["action"])
            {
                case "upload":
                    this.UploadImage();
                    return;

                case "delete":
                    this.DeleteImage();
                    return;
            }
            context.Response.Write("false");
        }

        private void UploadImage()
        {
            try
            {
                HttpPostedFile file = HttpContext.Current.Request.Files["Filedata"];
                string str = DateTime.Now.ToString("yyyyMMddHHmmss_ffff", DateTimeFormatInfo.InvariantInfo);
                string str2 = HttpContext.Current.Request["uploadpath"];
                string str3 = str + Path.GetExtension(file.FileName);
                if (string.IsNullOrEmpty(str2))
                {
                    str2 = Globals.GetVshopSkinPath(null) + "/images/ad/";
                    str3 = "imgCustomBg" + Path.GetExtension(file.FileName);
                    foreach (string str4 in Directory.GetFiles(Globals.MapPath(str2), "imgCustomBg.*"))
                    {
                        File.Delete(str4);
                    }
后面还有 25 行代码,购买后查看完整代码

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

AI 解读 AI

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

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