C# FCKEditor文件上载-不在生产服务器上工作-“;无效文件";

C# FCKEditor文件上载-不在生产服务器上工作-“;无效文件";,c#,fckeditor,C#,Fckeditor,我让FCKEditor(2.6.4)在我的开发机器上使用aspx连接器进行文件上传(这是一个asp.net网站),但我不知道如何让它在生产机器上工作。啊。在这上面花了4个小时却一无所获 从表面上看,这似乎是一个权限问题,但: 我已经仔细检查了IUSR、ASPNET和网络服务(现在甚至包括“Everyone”)是否有权在作为上传目标的“userfiles”文件夹中写入文件 我在设置fckconfig.js时遵循了法律规定 症状: 编辑工作很好。用户可以输入文本等 用户可以单击“插入图像”按钮

我让FCKEditor(2.6.4)在我的开发机器上使用aspx连接器进行文件上传(这是一个asp.net网站),但我不知道如何让它在生产机器上工作。啊。在这上面花了4个小时却一无所获

从表面上看,这似乎是一个权限问题,但:

  • 我已经仔细检查了IUSR、ASPNET和网络服务(现在甚至包括“Everyone”)是否有权在作为上传目标的“userfiles”文件夹中写入文件
  • 我在设置fckconfig.js时遵循了法律规定
症状:

  • 编辑工作很好。用户可以输入文本等
  • 用户可以单击“插入图像”按钮,从而打开图像选择器。可以插入服务器上已经存在的映像
  • 可以进入“文件上载”对话框,并通过fckeditor UI在服务器上成功创建新文件夹
  • 但是,每当用户试图上传一个小而有效的.png、.jpg、.gif、任何图像(在我的本地主机上可以正常工作)时,Firefox都会给我一条“无效文件”消息。(我尝试了许多不同大小和格式的有效图像文件。没有任何效果。图像无法上载到服务器。)
来自fckconfig.js的相关代码:

` var_FileBrowserLanguage='aspx'
var_QuickUploadLanguage='aspx'

//不要在意下面两行。它只计算正确的连接器 //用于默认文件浏览器的扩展名(Perl使用“cgi”)。 var\u FileBrowserExtension=\u FileBrowserLanguage=='perl'?'cgi':_filebrowser语言; var\u QuickUploadExtension=\u QuickUploadLanguage=='perl'?'cgi':_QuickUploadLanguage; `

来自fckeditor\editor\filemanager\connectors\aspx\config.ascx的代码:

`UserFilesPath=“~/userfiles/”


`

我已经切换到使用“ASP”连接器,它工作得非常好。出于某种原因,.aspx连接器在我的生产站点上不起作用(但在开发人员的机器上起作用),但ASP连接器工作正常

这不是一个“答案”,而是一个有效的解决办法

    // 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%" );