⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 upload.aspx.cs

📁 内容管理 内容管理 内容管理 内容管理 内容管理
💻 CS
字号:
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 HtmlEdit_upload_upload : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {
        if (Request.Files.Count > 0)
        {
            string sXMLPath = HttpContext.Current.Request.PhysicalApplicationPath + "HtmlEdit\\upload\\upload.xml" ;
            //string sXMLPath = Server.MapPath("./") + "upload.xml";
            //string sXMLPath = "/HtmlEdit/upload/upload.xml";


            System.Xml.XmlDocument oXMLDoc = new System.Xml.XmlDocument();
            oXMLDoc.Load(sXMLPath);
            System.Xml.XmlNode oNode = oXMLDoc.SelectSingleNode("/FCKeditor_Upload/FileNameCounter");

            int iCounter = int.Parse(oNode.InnerText) + 1;

            oNode.InnerText = iCounter.ToString();

            oXMLDoc.Save(sXMLPath);

            oNode = null;
            oXMLDoc = null;

            System.Web.HttpPostedFile oFile = Request.Files.Get("FCKeditor_File");

            string sFileURL = "/upfiles/" + "IMG" + iCounter.ToString().PadLeft(8, '0') + System.IO.Path.GetExtension(oFile.FileName);
            string sFilePath = HttpContext.Current.Request.PhysicalApplicationPath + "/upfiles/" + "IMG" + iCounter.ToString().PadLeft(8, '0') + System.IO.Path.GetExtension(oFile.FileName);
            Response.Write(sFilePath);
            oFile.SaveAs(sFilePath);

            Response.Write("<SCRIPT language=javascript>window.opener.setImage('" + sFileURL + "') ; window.close();</" + "SCRIPT>");
        }
    }
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -