當前位置:首頁 » 文件管理 » 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>"
上傳的也是源代碼,下次查看的時候還是黑體的不會丟失樣式啊

熱點內容
解壓到當前文件夾右鍵 發布:2024-04-26 03:57:08 瀏覽:979
html5android教程視頻下載 發布:2024-04-26 03:09:59 瀏覽:867
伺服器的描述是什麼 發布:2024-04-26 03:08:32 瀏覽:394
個人加密 發布:2024-04-26 03:01:23 瀏覽:521
linuxusbgadget 發布:2024-04-26 02:52:54 瀏覽:304
我的世界空島世界伺服器地址 發布:2024-04-26 01:39:08 瀏覽:248
尼爾機械紀元加密 發布:2024-04-26 01:37:11 瀏覽:868
在控制台輸出sql語句 發布:2024-04-26 01:08:12 瀏覽:432
動畫java 發布:2024-04-26 01:02:40 瀏覽:12
得力文件夾5302 發布:2024-04-26 00:21:32 瀏覽:91