upfile.aspx.cs

(开头部分) 3KB

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

using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;

public partial class upfile : System.Web.UI.Page
{
    string serverpath = null;
    comman com = new comman();
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
            if (Session["username"] == null)
            {
                //Response.Write("<script language=javascript>alert('您还没有会员登录!')</script>");
               
                //Response.Write("<script language=javascript>this.location=index.aspx;</script>");

                ClientScript.RegisterClientScriptBlock(this.GetType(), null, "<script>alert('您还没有会员登录!');window.location='index.aspx';</script>");
            }
        }

    }
    protected void Button1_Click(object sender, EventArgs e)
    {
        try
        {
            if (this.FileUpload1.PostedFile.FileName == "")
            {
                Response.Write("<script language=javascript>alert('要上传的文件不允许为空!')</script>");
                return;
            }
            else
            {
                string filepath = FileUpload1.PostedFile.FileName;
                string filename = string.Format("{0:yyyyMMddHHmmss}", DateTime.Now) + filepath.Substring(filepath.LastIndexOf("\\") + 1);
                string fileEx = filepath.Substring(filepath.LastIndexOf(".") + 1);
                //string serverpath = Server.MapPath("UpLoad/") + filename;


                serverpath = HttpRuntime.AppDomainAppPath + "UpLoad\\" + filename + "";



                //从config中读取文件上传路径
                //string FilePath = ConfigurationManager.AppSettings["FileUplodePath"].ToString();
                //string serverpath = FilePath + filename;
                //string serverpath1 = HttpRuntime.AppDomainAppPath + TxtPic.Text;
                //if (System.IO.File.Exists(serverpath1))
                //{
                //    System.IO.File.Delete(serverpath1);
                //}
                if (fileEx == "jpg" || fileEx == "bmp" || fileEx == "gif")
后面还有 33 行代码,解锁后查看完整代码

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

AI 解读 AI

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

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