我有我的開發機器上使用aspx連接器進行文件上傳(這是一個asp.net網站)的FCKEditor(2.6.4),但我無法確定瞭解如何讓它在生產機器上工作。 Arrgh。已經花了4個小時,並沒有得到。FCKEditor文件上傳 - 不在生產服務器上工作 - 「無效文件」
通過這似乎是一個權限問題悉數亮相,但是:
- 我已經雙重和三重檢查後IUSR和ASPNET和網絡服務(甚至是「每個人」,現在)有權限將文件寫入作爲上傳目標的「userfiles」文件夾中。
- 我已經按照法律條文設立fckconfig.js
症狀:
- 編輯器工作正常。用戶可以輸入文字等
- 用戶可以點擊插入圖像按鈕,這將啓動圖像選擇器。可以插入服務器上已經存在的圖像。
- 可以進入文件上傳對話框並通過fckeditor UI在服務器上成功創建一個新文件夾。
- 但是,無論用戶何時嘗試上傳小而有效的.png,.jpg,.gif,任何圖像(在我的本地主機上都可以正常工作),Firefox都會給我一個「無效文件」消息。 (我試過用不同大小和格式的衆多有效的圖像文件,無工作的圖像不會被上傳到服務器。)
從fckconfig.js相關代碼:
` 變種_FileBrowserLanguage ='aspx';
var _QuickUploadLanguage ='aspx';
//不關心以下兩行。它只是計算正確的連接器 //擴展名用於默認文件瀏覽器(Perl使用「cgi」)。 var _FileBrowserExtension = _FileBrowserLanguage =='perl'? 'cgi':_FileBrowserLanguage; var _QuickUploadExtension = _QuickUploadLanguage =='perl'? 'cgi':_QuickUploadLanguage;從fckeditor的\編輯\文件管理\連接器 `
代碼\ ASPX \ config.ascx:
`UserFilesPath = 「〜/ userfiles /」;
// The connector tries to resolve the above UserFilesPath automatically.
// Use the following setting it you prefer to explicitely specify the
// absolute path. Examples: 'C:\\MySite\\userfiles\\' or '/root/mysite/userfiles/'.
// Attention: The above 'UserFilesPath' URL must point to the same directory.
string ap = HttpContext.Current.Server.MapPath("~/userfiles/");
UserFilesAbsolutePath = ap;
//UserFilesAbsolutePath = "C:\\inetpub\\wwwroot\\hot-bigoven\\userfiles\\";
//UserFilesAbsolutePath = "C:\\inetpub\\wwwroot\\bigovenwebapp\\bigovenwebapp\\userfiles\\";
// Due to security issues with Apache modules, it is recommended to leave the
// following setting enabled.
//ForceSingleExtension = true;
// Allowed Resource Types
AllowedTypes = new string[] { "File", "Image", "Flash", "Media" };
// For security, HTML is allowed in the first Kb of data for files having the
// following extensions only.
HtmlExtensions = new string[] { "html", "htm", "xml", "xsd", "txt", "js" };
TypeConfig[ "File" ].AllowedExtensions = new string[] { "7z", "aiff", "asf", "avi", "bmp", "csv", "doc", "fla", "flv", "gif", "gz", "gzip", "jpeg", "jpg", "mid", "mov", "mp3", "mp4", "mpc", "mpeg", "mpg", "ods", "odt", "pdf", "png", "ppt", "pxd", "qt", "ram", "rar", "rm", "rmi", "rmvb", "rtf", "sdc", "sitd", "swf", "sxc", "sxw", "tar", "tgz", "tif", "tiff", "txt", "vsd", "wav", "wma", "wmv", "xls", "xml", "zip" };
TypeConfig[ "File" ].DeniedExtensions = new string[] { };
TypeConfig[ "File" ].FilesPath = "%UserFilesPath%file/";
TypeConfig[ "File" ].FilesAbsolutePath = (UserFilesAbsolutePath == "" ? "" : "%UserFilesAbsolutePath%file/");
TypeConfig[ "File" ].QuickUploadPath = "%UserFilesPath%";
TypeConfig[ "File" ].QuickUploadAbsolutePath = (UserFilesAbsolutePath == "" ? "" : "%UserFilesAbsolutePath%");
TypeConfig[ "Image" ].AllowedExtensions = new string[] { "bmp", "gif", "jpeg", "jpg", "png" };
TypeConfig[ "Image" ].DeniedExtensions = new string[] { };
TypeConfig[ "Image" ].FilesPath = "%UserFilesPath%image/";
TypeConfig[ "Image" ].FilesAbsolutePath = (UserFilesAbsolutePath == "" ? "" : "%UserFilesAbsolutePath%image/");
TypeConfig[ "Image" ].QuickUploadPath = "%UserFilesPath%";
TypeConfig[ "Image" ].QuickUploadAbsolutePath = (UserFilesAbsolutePath == "" ? "" : "%UserFilesAbsolutePath%");
TypeConfig[ "Flash" ].AllowedExtensions = new string[] { "swf", "flv" };
TypeConfig[ "Flash" ].DeniedExtensions = new string[] { };
TypeConfig[ "Flash" ].FilesPath = "%UserFilesPath%flash/";
TypeConfig[ "Flash" ].FilesAbsolutePath = (UserFilesAbsolutePath == "" ? "" : "%UserFilesAbsolutePath%flash/");
TypeConfig[ "Flash" ].QuickUploadPath = "%UserFilesPath%";
TypeConfig[ "Flash" ].QuickUploadAbsolutePath = (UserFilesAbsolutePath == "" ? "" : "%UserFilesAbsolutePath%");
TypeConfig[ "Media" ].AllowedExtensions = new string[] { "aiff", "asf", "avi", "bmp", "fla", "flv", "gif", "jpeg", "jpg", "mid", "mov", "mp3", "mp4", "mpc", "mpeg", "mpg", "png", "qt", "ram", "rm", "rmi", "rmvb", "swf", "tif", "tiff", "wav", "wma", "wmv" };
TypeConfig[ "Media" ].DeniedExtensions = new string[] { };
TypeConfig[ "Media" ].FilesPath = "%UserFilesPath%media/";
TypeConfig[ "Media" ].FilesAbsolutePath = (UserFilesAbsolutePath == "" ? "" : "%UserFilesAbsolutePath%media/");
TypeConfig[ "Media" ].QuickUploadPath = "%UserFilesPath%";
TypeConfig[ "Media" ].QuickUploadAbsolutePath = (UserFilesAbsolutePath == "" ? "" : "%UserFilesAbsolutePath%");
`