恩 看到了 <%@ Page Language="c#" Trace="false" Inherits="FredCK.FCKeditorV2.FileBrowser.Uploader" AutoEventWireup="false" %> <%@ Register Src="config.ascx" TagName="Config" TagPrefix="FCKeditor" %> <%-- * FCKeditor - The text editor for Internet - http://www.fckeditor.net * Copyright (C) 2003-2008 Frederico Caldeira Knabben * * == BEGIN LICENSE == * * Licensed under the terms of any of the following licenses at your * choice: * * - GNU General Public License Version 2 or later (the "GPL") * http://www.gnu.org/licenses/gpl.html * * - GNU Lesser General Public License Version 2.1 or later (the "LGPL") * http://www.gnu.org/licenses/lgpl.html * * - Mozilla Public License Version 1.1 or later (the "MPL") * http://www.mozilla.org/MPL/MPL-1.1.html * * == END LICENSE == * * This is the Uploader for ASP.NET. * * The code of this page if included in the FCKeditor.Net package, * in the FredCK.FCKeditorV2.dll assemblyfile. So to use it you must * include that DLL in your "bin" directory. * * To download the FCKeditor.Net package, go to our official web site: * http://www.fckeditor.net --%> <FCKeditor:Config id="Config" runat="server"></FCKeditor:Config> 上面就是upload.aspx页面的代码 代码全部复制到新建的页面就可以吗 然后再获取图片名称是吗?
FCK那个上传是一个单独的页面,所有的图片都上传你所指定的目录,你只需要写方法去获取那个目录下的所有图片即可
MatchCollection matchs = Regex.Matches(fckStr, @ " <img\s[^> ]*src=([ " " ']*)(? <src> [^ ' " "]*)\1[^> ]*> ", RegexOptions.IgnoreCase);
foreach (Match m in matchs) {
Response.Write(m.Groups[ "src "].Value+ " <br> ");
}
<%@ Page Language="c#" Trace="false" Inherits="FredCK.FCKeditorV2.FileBrowser.Uploader" AutoEventWireup="false" %>
<%@ Register Src="config.ascx" TagName="Config" TagPrefix="FCKeditor" %>
<%--
* FCKeditor - The text editor for Internet - http://www.fckeditor.net
* Copyright (C) 2003-2008 Frederico Caldeira Knabben
*
* == BEGIN LICENSE ==
*
* Licensed under the terms of any of the following licenses at your
* choice:
*
* - GNU General Public License Version 2 or later (the "GPL")
* http://www.gnu.org/licenses/gpl.html
*
* - GNU Lesser General Public License Version 2.1 or later (the "LGPL")
* http://www.gnu.org/licenses/lgpl.html
*
* - Mozilla Public License Version 1.1 or later (the "MPL")
* http://www.mozilla.org/MPL/MPL-1.1.html
*
* == END LICENSE ==
*
* This is the Uploader for ASP.NET.
*
* The code of this page if included in the FCKeditor.Net package,
* in the FredCK.FCKeditorV2.dll assemblyfile. So to use it you must
* include that DLL in your "bin" directory.
*
* To download the FCKeditor.Net package, go to our official web site:
* http://www.fckeditor.net
--%>
<FCKeditor:Config id="Config" runat="server"></FCKeditor:Config>
上面就是upload.aspx页面的代码 代码全部复制到新建的页面就可以吗 然后再获取图片名称是吗?
/// 取得FCK,HTML中所有图片的 URL。
/// </summary>
/// <param name="sHtmlText">HTML代码</param>
/// <returns>图片的URL列表</returns>
public string[] GetHtmlImageUrl(string sHtmlText)
{
// 定义正则表达式用来匹配 img 标签
Regex regImg = new Regex(@"<img\b[^<>]*?\bsrc[\s\t\r\n]*=[\s\t\r\n]*[""']?[\s\t\r\n]*(?<imgUrl>[^\s\t\r\n""'<>]*)[^<>]*?/?[\s\t\r\n]*>", RegexOptions.IgnoreCase); // 搜索匹配的字符串
MatchCollection matches = regImg.Matches(sHtmlText); int i = 0;
string[] sUrlList = new string[matches.Count]; // 取得匹配项列表
foreach (Match match in matches)
sUrlList[i++] = match.Groups["imgUrl"].Value; return sUrlList;
}