当前位置:首页 » 文件管理 » fckeditor上传

fckeditor上传

发布时间: 2022-07-05 15:39:07

‘壹’ fckeditor上传图片问题

因为你限制大小了 可能是你服务器配置不全 网上可以限制 它总出现那个滚动条是因为传布上去 你把它设置一下 改下204 提示语为“超过100k的不能上传”

‘贰’ ASP中fckeditor上传图片问题

fckeditor是无组件上传的,只所以出现这个情况是因为你没有配置好,你可以从网上查找一下相关说明,详细配置一下,如果嫌麻烦,可以联系我,给我发消息留个QQ号,我回头给你传一个配置好的。

‘叁’ FCKeditor 上传文件大小如何限制

方法如下:
/// 获取允许上传的类型
/// </summary>
protected string UserUploadType
...{
get
...{
if (sUserUploadType == null)
...{
// Try to get from the "Application".
sUserUploadType = (string)Application["FCKeditor:UserUploadType"];
// Try to get from the "Session".
if (sUserUploadType == null || sUserUploadType.Length == 0)
...{
sUserUploadType = (string)Session["FCKeditor:UserUploadType"];
// Try to get from the Web.config file.
if (sUserUploadType == null || sUserUploadType.Length == 0)
...{
sUserUploadType = System.Web.Configuration.WebConfigurationManager.AppSettings["FCKeditor:UserUploadType"];
// Otherwise use the default value.
if (sUserUploadType == null || sUserUploadType.Length == 0)
sUserUploadType = DEFAULT_USER_FILES_UPLOADTYPE;
}
}
// Check that the user path starts and ends with slash (".")
if (!sUserUploadType.StartsWith("."))
sUserUploadType = "." + sUserUploadType;
if (!sUserUploadType.EndsWith("."))
sUserUploadType += ".";
}
return sUserUploadType;
}
}
/**//// <summary>
/// 获取允许上传的文件最大限制
/// </summary>
protected int UserUploadSize
...{
get
...{
if (iUserUploadSize < 1)
...{
iUserUploadSize = Convert.ToInt32(Application["FCKeditor:UserUploadSize"]);
if (iUserUploadSize < 1)
...{
iUserUploadSize = Convert.ToInt32(Session["FCKeditor:UserUploadSize"]);
if (iUserUploadSize < 1)
...{
iUserUploadSize = Convert.ToInt32(System.Web.Configuration.WebConfigurationManager.AppSettings["FCKeditor:UserUploadSize"]);
if (iUserUploadSize < 1)
...{
iUserUploadSize = DEFAULT_USER_FILES_UPLOADSIZE;
}
}
}
}
return iUserUploadSize;
}
}
}
}
接着就是对点击"浏览服务器"页面的上传部分的修改
以下是对FileBrowserConnector.cs中的FileUpload()函数的修改
private void FileUpload(string resourceType, string currentFolder)
...{
HttpPostedFile oFile = Request.Files["NewFile"];
string sErrorNumber = "0";
string sFileName = "";
if (oFile != null && oFile.ContentLength > 0)
...{
// Map the virtual path to the local server path.
string sServerDir = this.ServerMapFolder(resourceType, currentFolder);
/**//*
// Get the uploaded file name.
sFileName = System.IO.Path.GetFileName( oFile.FileName ) ;
int iCounter = 0 ;
while ( true )
{
string sFilePath = System.IO.Path.Combine( sServerDir, sFileName ) ;
if ( System.IO.File.Exists( sFilePath ) )
{
iCounter++ ;
sFileName =
System.IO.Path.GetFileNameWithoutExtension( oFile.FileName ) +
"(" + iCounter + ")" +
System.IO.Path.GetExtension( oFile.FileName ) ;
sErrorNumber = "201" ;
}
else
{
oFile.SaveAs( sFilePath ) ;
break ;
}
}
*/
if (this.UserUploadType.ToLower().IndexOf(System.IO.Path.GetExtension(oFile.FileName).ToLower() + ".") > -1)//检测是否为允许的上传文件类型
...{
if (this.UserUploadSize * 1024 >= oFile.ContentLength)//检测文件大小是否超过限制
...{
sFileName = DateTime.Now.ToString("yyyyMMddHHmmssffff") + System.IO.Path.GetExtension(oFile.FileName);
string sFilePath = System.IO.Path.Combine(sServerDir, sFileName);
oFile.SaveAs(sFilePath);
}
else//文件大小超过限制
...{
Response.Clear();
Response.Write("<script type="text/javascript">");
Response.Write("window.parent.frames['frmUpload'].OnUploadCompleted(1,'上传文件大小超出限制') ;");
Response.Write("</script>");
Response.End();
}
}
else //文件类型不允许上传
...{
Response.Clear();
Response.Write("<script type="text/javascript">");
Response.Write("window.parent.frames['frmUpload'].OnUploadCompleted(1,'上传文件类型不允许') ;");
Response.Write("</script>");
Response.End();
}

}
else
sErrorNumber = "202";
Response.Clear();
Response.Write("<script type="text/javascript">");
Response.Write("window.parent.frames['frmUpload'].OnUploadCompleted(" + sErrorNumber + ",'" + sFileName.Replace("'", "/'") + "') ;");
Response.Write("</script>");
Response.End();
}
最后就是对Uploader.cs类中的OnLoad()函数的修改
protected override void OnLoad(EventArgs e)
...{
// Get the posted file.
HttpPostedFile oFile = Request.Files["NewFile"];
// Check if the file has been correctly uploaded
if (oFile == null || oFile.ContentLength == 0)
...{
SendResults(202);
return;
}
int iErrorNumber = 0;
string sFileUrl = "";
string sFileName = "";
//使用原文件名上传代码,如果文件名相同,则在后面加上标号(1)(2)...
/**//*
// Get the uploaded file name.
string sFileName = System.IO.Path.GetFileName( oFile.FileName ) ;

int iCounter = 0 ;
while ( true )
{
string sFilePath = System.IO.Path.Combine( this.UserFilesDirectory, sFileName ) ;
if ( System.IO.File.Exists( sFilePath ) )
{
iCounter++ ;
sFileName =
System.IO.Path.GetFileNameWithoutExtension( oFile.FileName ) +
"(" + iCounter + ")" +
System.IO.Path.GetExtension( oFile.FileName ) ;
iErrorNumber = 201 ;
}
else
{
oFile.SaveAs( sFilePath ) ;
sFileUrl = this.UserFilesPath + sFileName ;
break ;
}
}
*/
//使用原文件名上传代码结束
//使用时间作为流水号文件名

if (this.UserUploadSize * 1024 >= oFile.ContentLength)//检测文件大小是否超过限制
...{
sFileName = DateTime.Now.ToString("yyyyMMddHHmmssffff") + System.IO.Path.GetExtension(oFile.FileName);
string sFilePath = System.IO.Path.Combine(this.UserFilesDirectory, sFileName);
oFile.SaveAs(sFilePath);
sFileUrl = this.UserFilesPath + sFileName;
}
else//文件大小超过限制
...{
SendResults(1, "", "", "上传文件大小超出限制");
}
/**//////////////////////////////////////////////////////////////////////////////
SendResults(iErrorNumber, sFileUrl, sFileName);
}
最后只要在Web.Config文件中加入对文件上传的限制值就可以了.
<?xml version="1.0"?>
<configuration xmlns="http://schemas.microsoft.com/.NetConfiguration/v2.0">
<appSettings>
<add key="FCKeditor:UserFilesPath" value="/UserFiles/" />
<add key="FCKeditor:UserUploadType" value=".gif.jpg.jpeg.rar.zip.swf.png" />
<add key="FCKeditor:UserUploadSize" value="5120" /><!--单位为KB-->
</appSettings>
<system.web>
<httpRuntime maxRequestLength="512000" />
</system.web>

</configuration>

‘肆’ fckeditor 编辑器快速上传图片

引用:http://student.csdn.net/space.php?uid=53812&do=blog&id=28068
有问题可以和我聊,我也正在研究这个东东

快速上传:
FCKeditor\editor\filemanager\upload\
asp\
23 ConfigIsEnabled = False
是否启用快速上传
27 ConfigUserFilesPath = "/UserFiles/"
如果想上传到 /test/upload/yyymmdd/的文件夹下面
则修改为 ConfigUserFilesPath = "/test/upload/" & year(now())& right("0"& month(now()),2)&right("0" & day(now()),2)

php与asp 不同的地方
php上传设置

FCKeditor\editor\filemanager\browser\default\connectors\php下面
config.php

$Config['Enabled'] = true ; 启用上传

$Config['UserFilesPath'] = '/test/upload/' ; url显示出来的路径,

$Config['UserFilesAbsolutePath'] = 'e:/web/upload' ;服务器上的真实路径,建议配置上这个。否则可能出现失去响应的情况

相应文件类型设置:39-40行
connector.php
71行
if ( !in_array( $sResourceType,array('File','Image','Flash','Media') ) )
return ;

]
表示文件类型

快速上传FCKeditor\editor\filemanager\upload\php
config.php

$Config['Enabled'] = true ;//启用

// Path to uploaded files relative to the document root.
$Config['UserFilesPath'] = '/test/upload/' ;这是url相对文档根

$Config['UserFilesAbsolutePath'] = 'e:/web/upload/' ;这才是服务器上的绝对路径 建议与上面u那个路径同时都配置上,如果出现了php上传没有反映的问题则可能是这个没有配置。

‘伍’ java下FCKeditor上传图片问题

先到tomcat->webapps里建立一个文件夹叫mysite。把FCKeditor里的/editor和fckconfig.js, fckeditor.js, fckstyles.xml, fcktemplates.xml四个文件到mysite文件夹里,因为别的文件对我们来说没有什么意义。再把FCKeditor.java 2.3中的web目录下的WEB-INF目录到mysite下(里面有commons-fileupload.jar, FCKeditor-2.3.jar,web.xml等几个文件), 把其中的src目录下的FCKeditor.tld文件到mysite/WEB-INF/下.这样它才支持JSP。

下面我们要对其中的一些文件进行修改:
打开fckconfig.js 文件,修改 FCKConfig.DefaultLanguage = ''zh-cn'' ;
把FCKConfig.LinkBrowserURL等的值替换成以下内容:
FCKConfig.LinkBrowserURL = FCKConfig.BasePath + "filemanager/browser/default/browser.html?Connector=connectors/jsp/connector" ;

FCKConfig.ImageBrowserURL = FCKConfig.BasePath + "filemanager/browser/default/browser.html?Type=Image&Connector=connectors/jsp/connector" ;

FCKConfig.FlashBrowserURL = FCKConfig.BasePath + "filemanager/browser/default/browser.html?Type=Flash&Connector=connectors/jsp/connector" ;

FCKConfig.LinkUploadURL = FCKConfig.BasePath + ''filemanager/upload/simpleuploader?Type=File'' ;

FCKConfig.FlashUploadURL = FCKConfig.BasePath + ''filemanager/upload/simpleuploader?Type=Flash'' ;

FCKConfig.ImageUploadURL = FCKConfig.BasePath + ''filemanager/upload/simpleuploader?Type=Image'' ;

打开WEB-INF下面的web.xml文件:
把SimpleUploader中的配置属性enabled定义为true(开启文件上传功能)
添加标签定义:
<taglib>
<taglib-uri>/mysite</taglib-uri>
<taglib-location>/WEB-INF/FCKeditor.tld</taglib-location>
</taglib>

这样文件就设置完了,这时建立一个jsp文件试试:
<%@ page contentType="text/html; charset=gb2312" language="java" import="java.sql.*" import="java.util.*" import="java.text.*" errorPage="" %>
<%@ page language="java" import="com.fredck.FCKeditor.*" %>
<%@ taglib uri="/mysite" prefix="FCK" %>
<script type="text/javascript" src="/mysite/fckeditor.js"></script>
<form method="POST" action="Bs_Bulletin_save.jsp">
<table width="100%" border="0" cellspacing="1" cellpadding="2">
<tr>
<td width="19%" bgcolor="#F0F0F0" height="25" align="right">标题:</td>
<td width="81%" bgcolor="#F0F0F0"><INPUT TYPE="text" NAME="title" size="58"></td>
</tr>
<tr>
<td width="19%" height="300" bgcolor="#F0F0F0">
<div align="center">中文信息设置<BR><BR>
<span style="color: #FF0000">支持html(图片大小宽度不要超过170个象素)</span></div>
</td>
<td width="81%" bgcolor="#F0F0F0">
<textarea name="content" cols="58" rows="15"></textarea>
<script type="text/javascript">
var oFCKeditor = new FCKeditor(''content'') ;
oFCKeditor.BasePath = "/mysite/" ;
oFCKeditor.Height = 400;
oFCKeditor.ToolbarSet = "Default" ;
oFCKeditor.ReplaceTextarea();
</script>
</td>
</tr>
<tr>
<td width="19%" height="25" bgcolor="#F0F0F0">发布时间:</td>
<td width="81%" bgcolor="#F0F0F0"><INPUT TYPE="text" NAME="datatimes" value="<%=time%>" size="58"></td>
</tr>

<tr>
<td colspan="2" bgcolor="#F0F0F0">
<div align="center"><input type="submit" value=" 添 加 " name="cmdok"><input type="reset" value=" 重 写 " name="cmdcancel"></div></td>
</tr>
</table>
</form>

加红字的部分,就是调用这个在线编辑器了。现在上传的图看一下,提示internal server error 500,还记得一开始时,我们提到的xalan.jar吗,现在把xalan.jar放到lib文件夹里,关掉tomcat再重起一下,应该好用了……

注意,如果想把这个控件融入你现有的web应用系统中,就不需要新建mysite了,你可以这样做:

1、把FCKeditor里的/editor和fckconfig.js, fckeditor.js, fckstyles.xml, fcktemplates.xml四个文件直接到现有web应用的某个目录下。

2、把FCKeditor.java 2.3中WEB-INF目录里的commons-fileupload.jar, FCKeditor-2.3.jar放在现有系统的lib目录下。

3、在现有系统的web.xml中加入FCKeditor.java 2.3中web.xml的配置信息,并添加标签定义:
<taglib>
<taglib-uri>/mysite</taglib-uri>
<taglib-location>/WEB-INF/FCKeditor.tld</taglib-location>
</taglib>
这里别忘了把SimpleUploader中的配置属性enabled定义为true以开启文件上传功能!

4、然后把FCKeditor.tld文件到现有系统的WEB-INF/下,这样就可以了。当然,FCKeditor.tld的位置不是绝对的,你可以放在其它地方,只要在前面的标签定义中指定相应的位置就行了。

附:FCKeditor.java中web.xml配置信息
<servlet>
<servlet-name>Connector</servlet-name>
<servlet-class>com.fredck.FCKeditor.connector.ConnectorServlet</servlet-class>
<init-param>
<param-name>baseDir</param-name>
<param-value>/UserFiles/</param-value><!--上传附件所在根路径 -->
</init-param>
<init-param>
<param-name>debug</param-name>
<param-value>false</param-value><!--启动服务时是否显示调试信息 -->
</init-param>
<load-on-startup>1</load-on-startup>
</servlet>
<servlet>
<servlet-name>SimpleUploader</servlet-name>
<servlet-class>com.fredck.FCKeditor.uploader.SimpleUploaderServlet</servlet-class>
<init-param>
<param-name>baseDir</param-name>
<param-value>/UserFiles/</param-value><!--上传附件所在根路径 -->
</init-param>
<init-param>
<param-name>debug</param-name>
<param-value>false</param-value><!--启动服务时是否显示调试信息 -->
</init-param>
<init-param>
<param-name>enabled</param-name>
<param-value>true</param-value><!--是否开启上传文件功能 -->
</init-param>
<init-param>
<param-name>AllowedExtensionsFile</param-name>
<param-value></param-value>
</init-param>
<init-param>
<param-name>DeniedExtensionsFile</param-name>
<param-value>php|php3|php5|phtml|asp|aspx|ascx|jsp|cfm|cfc|pl|bat|exe|dll|reg|cgi</param-value>
</init-param>
<init-param>
<param-name>AllowedExtensionsImage</param-name>
<param-value>jpg|gif|jpeg|png|bmp</param-value>
</init-param>
<init-param>
<param-name>DeniedExtensionsImage</param-name>
<param-value></param-value>
</init-param>
<init-param>
<param-name>AllowedExtensionsFlash</param-name>
<param-value>swf|fla</param-value>
</init-param>
<init-param>
<param-name>DeniedExtensionsFlash</param-name>
<param-value></param-value>
</init-param>
<load-on-startup>2</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>Connector</servlet-name>
<url-pattern>/webapp/FCKeditor/editor/filemanager/browser/default/connectors/jsp/connector</url-pattern><!--FCKeditor所在目录,即/editor和fckconfig.js, fckeditor.js, fckstyles.xml, fcktemplates.xml四个文件所在目录 -->
</servlet-mapping>

<servlet-mapping>
<servlet-name>SimpleUploader</servlet-name>
<url-pattern>/webapp/FCKeditor/editor/filemanager/upload/simpleuploader</url-pattern><!--FCKeditor所在目录 -->
</servlet-mapping>

<taglib>
<taglib-uri>/home/project/law/FCKeditor</taglib-uri>
<taglib-location>/WEB-INF/FCKeditor.tld</taglib-location><!--FCKeditor.tld路径 -->
</taglib>

‘陆’ asp版FckEditor图片上传问题

一般都是编码问题,fckeditor采用的是utf-8
你可能需要修改FCKeditor\editor\filemanager\browser\default\connectors\asp\basexml.asp
在'
Set
the
response
format.下一行添加
Response.CodePage=65001
希望可以帮到你。

‘柒’ fckeditor上传图片问题 不能上传

在FCKEditor2.4.1版在.net环境中图片上传的正确配置,以供大家参考,以少走弯路。
asp.net下的fckeditor2.4.1配置
用最简单的语言描述一下。其它配置和优化就不说了,只说怎么让它在asp.net环境下能用,能上传。
1、下载文件 http://www.fckeditor.net/download
FCKeditor_2.4.1.zip 和 FCKeditor.Net_2.2.zip
这是目前最新的版本。 FCKeditor_2.4.1.zip 为fckeditor的页面文件 FCKeditor.Net_2.2.zip 是asp.net下的上传用的 dll控件和其源文件
2、 解压FCKeditor_2.4.1.zip 到网站根目录下的 fckeditor中,解压FCKeditor.Net_2.2.zip 将其目录 FCKeditor.Net_2.2\bin\Release中的 FredCK.FCKeditorV2.dll 复制到 根目录的/bin/下
3、打开/fckeditor/fckconfig.js 修改两行代码
var _FileBrowserLanguage = 'aspx' ;
var _QuickUploadLanguage = 'aspx' ;
把默认的asp语言改成aspx
4、这就算行了,开始用吧。根目录下建立test.aspx,其代码如下:
<%@ Page language="c#" AutoEventWireup="false" validateRequest=false%>
<%@ Register TagPrefix="FCKeditorV2" Namespace="FredCK.FCKeditorV2" Assembly="FredCK.FCKeditorV2" %>
<form id="Form1" method="post" runat="server">
<FCKeditorV2:FCKeditor id="content" runat="server"></FCKeditorV2:FCKeditor>
</form>
应该就ok了,可以上传。默认传到根目录的/UserFiles/下,不用自己建,它自己会建。
如果要改上传目录,需要修改FCKeditor.Net_2.2.zip这个包里的.net源文件。修改FileWorkerBase.cs ,改一下26行
private const string DEFAULT_USER_FILES_PATH = "/UserFiles/" ;
重新编译一下,生成新的dll,复制过去,应该就OK了。(这个我没试,应该没问题)
另外,说一句,fckeditor是很灵活的,可以做很多高级的设置。
还 有的网友,自己优化了它的源文件,有的给它加了功能,比如传视频,传文件什么的。 但这些修改过的版本,有的是有问题的。 曾经下过一个修改了的2.0 版本, asp下,怎么设置都上传不了图片。 重新下个,随便设置一下就可以了。所以,还是推荐大家用官方提供的版本。

‘捌’ fckeditor 上传图片的问题

是传递到web.config里面的value路径里指定的值,你写的是哪里他就传递到哪里哈!自己修改一下路径吧!
<add key="FCKeditor:UserFilesPath" value="~/Userfiles/image" />

‘玖’ 请问fckeditor是如何实现上传的呢

上传的是文字。确切的是说是源代码
比如:你看见的是黑体的“我”
其实源代码是"<b>我</b>"
上传的也是源代码,下次查看的时候还是黑体的不会丢失样式啊

热点内容
matlab获取文件夹 发布:2024-05-05 21:12:24 浏览:289
一根式算法 发布:2024-05-05 21:12:23 浏览:954
php无刷新 发布:2024-05-05 21:08:11 浏览:981
搭建一个流媒体服务器 发布:2024-05-05 20:40:59 浏览:666
2017中超数据库 发布:2024-05-05 20:37:25 浏览:378
编程包游戏 发布:2024-05-05 20:25:00 浏览:608
系统锁屏忘记密码如何设置 发布:2024-05-05 20:18:07 浏览:759
xp怎样访问win7 发布:2024-05-05 20:17:07 浏览:870
c语言访问http 发布:2024-05-05 20:04:14 浏览:874
什么可以配置波尔多叶 发布:2024-05-05 20:00:32 浏览:964