Hidistro.UI.Web/Admin/Shop/ImageFtp.cs

(开头部分) 3KB

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

namespace Hidistro.UI.Web.Admin.Shop
{
    using Hidistro.ControlPanel.Store;
    using Hidistro.Core;
    using Hidistro.UI.ControlPanel.Utility;
    using System;
    using System.Globalization;
    using System.IO;
    using System.Text;
    using System.Web;
    using System.Web.UI.HtmlControls;
    using System.Web.UI.WebControls;

    public class ImageFtp : AdminPage
    {
        protected Button btnSaveImageFtp;
        protected ImageDataGradeDropDownList dropImageFtp;
        protected System.Web.UI.WebControls.FileUpload FileUpload;
        protected HtmlForm thisForm;

        protected ImageFtp() : base("m01", "dpp08")
        {
        }

        private void btnSaveImageFtp_Click(object sender, EventArgs e)
        {
            string str = Globals.GetStoragePath() + "/gallery";
            int categoryId = Convert.ToInt32(this.dropImageFtp.SelectedItem.Value);
            int num2 = 0;
            int num3 = 0;
            new StringBuilder();
            HttpFileCollection files = base.Request.Files;
            for (int i = 0; i < files.Count; i++)
            {
                HttpPostedFile postedFile = files[i];
                if (postedFile.ContentLength > 0)
                {
                    num2++;
                    try
                    {
                        string str2 = Guid.NewGuid().ToString("N", CultureInfo.InvariantCulture) + Path.GetExtension(postedFile.FileName);
                        string str3 = postedFile.FileName.Substring(postedFile.FileName.LastIndexOf(@"\") + 1);
                        string photoName = str3.Substring(0, str3.LastIndexOf("."));
                        string str5 = DateTime.Now.ToString("yyyyMM").Substring(0, 6);
                        string virtualPath = str + "/" + str5 + "/";
                        int contentLength = postedFile.ContentLength;
                        string path = base.Request.MapPath(virtualPath);
                        string photoPath = "/Storage/master/gallery/" + str5 + "/" + str2;
                        DirectoryInfo info = new DirectoryInfo(path);
                        if (ResourcesHelper.CheckPostedFile(postedFile, "image"))
                        {
                            if (!info.Exists)
                            {
                                info.Create();
                            }
                            postedFile.SaveAs(base.Request.MapPath(virtualPath + str2));
                            if (GalleryHelper.AddPhote(categoryId, photoName, photoPath, contentLength))
                            {
                                num3++;
                            }
后面还有 28 行代码,购买后查看完整代码

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

AI 解读 AI

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

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