autoupload.aspx.cs
来自「如果不使用IIS,请先运行 XSP.exe,待提示已侦听 8080端口后」· CS 代码 · 共 44 行
CS
44 行
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 + =
减小字号Ctrl + -
显示快捷键?