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

📄 autoupload.aspx.cs

📁 如果不使用IIS,请先运行 XSP.exe,待提示已侦听 8080端口后
💻 CS
字号:
using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Text;
using System.Text.RegularExpressions;
using System.IO;


namespace SvnHostFCK.fckeditor.editor.plugins.autoupload
{
    public partial class AutoUpload : System.Web.UI.Page
    {
        public string script = "var oEditor = window.parent.InnerDialogLoaded();var fck = oEditor.FCK;document.getElementById('html').value = fck.GetHTML();document.getElementById('form1').submit();";
        protected void Page_Load(object sender, EventArgs e)
        {
            if (Request.RequestType.ToLower().Equals("post"))
            {
                string html = Request.Form["html"];
                MatchCollection mc = Regex.Matches(html, "<img[\\s\\S]*?src\\s*?=[\\s\'\"]*?(?<img>http://[\\s\\S]*?((jpg)|(gif)|(bmp)|(png)))[\\s\'\"]*?", RegexOptions.Compiled|RegexOptions.IgnoreCase);
                for (int i = 0; i < mc.Count; i++)
                {
                    string img = mc[i].Groups["img"].Value;
                    string filename = Guid.NewGuid().ToString() + Path.GetExtension(img);
                    string path = DateTime.Now.ToShortDateString();
                    if (!Directory.Exists(Server.MapPath(System.Configuration.ConfigurationManager.AppSettings["uploadUrl"] + path)))
                        Directory.CreateDirectory(Server.MapPath(System.Configuration.ConfigurationManager.AppSettings["uploadUrl"] + path));

                    new System.Net.WebClient().DownloadFile(img, Server.MapPath(System.Configuration.ConfigurationManager.AppSettings["uploadUrl"] + path + "/" + filename));
                    html = html.Replace(img, System.Configuration.ConfigurationManager.AppSettings["uploadUrl"] + path + "/" + filename);
                }

                script = "var oEditor = window.parent.InnerDialogLoaded();var fck = oEditor.FCK;fck.SetHTML('" + html + "');window.parent.Cancel();";
            }
        }
    }
}

⌨️ 快捷键说明

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