upload_img.aspx.cs

(开头部分) 2KB

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

using System;
using System.Collections.Generic;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Data.OleDb;
using System.IO;

namespace web.admin.Merchandise
{
    public partial class upload : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {

        }

        protected void Button1_Click(object sender, EventArgs e)
        {
            if (this.myFile.PostedFile != null)//上传文件
            {
                if (this.myFile.PostedFile.FileName != "")
                {
                    string photoName1 = myFile.PostedFile.FileName; //获取初始文件名    
                    int i = photoName1.LastIndexOf("."); //取得文件名中最后一个"."的索引    
                    string newext = photoName1.Substring(i).ToLower(); //获取文件扩展名    
                    if (newext == ".aspx" || newext == ".asp" || newext == ".php" || newext == ".jsp" || newext == ".cgi" || newext == ".asa" || newext == ".ashx")
                    {
                        Response.Write("文件格式不正确!");
                        Response.End();
                    }

                    string fileName = Path.GetFileName(this.myFile.FileName);

                    DateTime now = DateTime.Now; //获取系统时间
                    Random rd = new Random();

                    string nyr = "/file/" + get.nyrsfm();
                    //System.IO.Directory.CreateDirectory(Server.MapPath(nyr));//这里是不改变文件名
                    //string photoName2 = nyr + "/" + fileName;// +"" + fileName;//这里是不改变文件名
                    string photoName2 = nyr + newext;

                    myFile.PostedFile.SaveAs(Server.MapPath(photoName2)); // 保存文件到路径,用Server.MapPath()取当前文件的绝对目录.在asp.net里"\"必须用""代替

                    if (Request.QueryString["yzm"] != null)
                    {
                        photoName2 = new WaterImageManage().DrawWords(photoName2, "www.albeads.com", 0.3F, ImagePosition.Center, Server.MapPath("/file/"));
                    }

                    this.TextBoxname.Text = photoName2;

                    string sqlstring = "insert into filedata (filename,fileurl,times) values('','" + photoName2 + "','" + DateTime.Now.ToString().ToString() + "')";
                    new AcsHelper().ExecuteNonQuery(sqlstring);
                    

                    Page.ClientScript.RegisterStartupScript(this.GetType(), "", "<script>foo();</script>");
                }
            }
        }
    }
后面还有 1 行代码,购买后查看完整代码

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

AI 解读 AI

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

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