FileUploadPanel.ascx.cs

(开头部分) 2KB

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

using System;
using System.Text;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Reflection;

public partial class FileUploadPanel : System.Web.UI.UserControl
{
    string mflCouldUserTypes = "|.jpeg|.jpg|.gif|.png|.JPG|.JPEG|.GIF|.PNG|";
    string[] array = new string[5];
    protected void Page_Load(object sender, EventArgs e)
    {
        ///5/1/a/s/px/
    }
   
    protected void btnUpload_Click(object sender, EventArgs e)
    {
        if (Request.Files.Count > 0)
        {
            StringBuilder sbFileName = new StringBuilder();
            string[] array = new string[6];
            for (int i=0;i<Request.Files.Count;i++)
            {
                if (Request.Files[i].ContentLength > 0 )
                {
                    if (Request.Files[i].ContentLength < 4069000)
                    {
                        string fileType = Request.Files[i].FileName.Substring(Request.Files[i].FileName.LastIndexOf('.'));
                        if (mflCouldUserTypes.IndexOf("|" + fileType + "|") == -1)
                        {//上传了非设置的图片
                            continue;
                        }
                        string newFileName = DateTime.Now.ToString("yyyyMMddHHmmssms" + i) + fileType;
                        Request.Files[i].SaveAs(Server.MapPath("images/" + newFileName));
                        string url = "~/images/" + newFileName;
                        array[i] = url;
                        //ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "click", "alert('上传成功!');", true);
                        //Response.Write("<script languge='javascript'>alert('上传成功!');window.location.href=#mid'</script>");
                        Response.Write("<script languge='javascript'> window.location.href='#mid'</script>");
                        Label1.Visible = true;
                        Label1.Text = "上传成功";
                     }
                    else
                    {
                        //ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "click", "alert('文件超过4M!');", true);
                        //Response.Write("<script languge='javascript'>alert('文件超过4M!');window.location.href=#mid'</script>");
                        Response.Write("<script languge='javascript'> window.location.href='#mid'</script>");
                        Label1.Visible = true;
                        Label1.Text = "文件超过4M或类型错误!";
                        return;
                    }
                }
                
            }
            
            this.Page.GetType().InvokeMember("arr", BindingFlags.InvokeMethod, null, this.Page, new object[] { array[0], array[1], array[2], array[3], array[4] });
        }
后面还有 3 行代码,购买后查看完整代码

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

AI 解读 AI

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

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