日期:2014-05-18  浏览次数:20381 次

FCKeditor插件:Meida|多媒体插入 上传文件时报告“FCKConfig.MediaUploadAllowedExtensions.length为空或
参考文章《利用Fckeditor插入MP3或视频文件》进行编写,是通过修改FCK的Flash插入实现插入多媒体的,和这里的插件原理是一样的。
插件的具体使用方法如下:
1、解压文件到 FCKeditor\editor\plugins
2、修改配置文件 FCKeditor\fckconfig.js ,包括启用插件和添加按钮。
JavaScript代码
1. FCKConfig.PluginsPath = FCKConfig.BasePath + 'plugins/' ; //找到这一句,配置插件路径
2. FCKConfig.Plugins.Add( 'Media', 'en,zh,zh-cn' ) ; //启用插件
3.  
4. ………… //中间代码省略 
5.  
6. FCKConfig.ToolbarSets["Default"] = [  
7. ['Source','Templates'],  
8. ['FontName','FontSize'],  
9. ['TextColor','BGColor'],  
10. ['Image','Flash'], //可以用Media替换Flash 
11. ['Table','Rule'],  
12. ['FitWindow','ShowBlocks'],  
13. ['Smiley','SpecialChar','Media'], //或者加入Media按钮
14. '/',  
15. ['PasteText','PasteWord','RemoveFormat'],  
16. ['Undo','Redo','Find','Replace'],  
17. ['Bold','Italic','Underline','StrikeThrough'],  
18. ['OrderedList','UnorderedList','-','Outdent','Indent','Blockquote'],  
19. ['JustifyLeft','JustifyCenter','JustifyRight'],  
20. ['Anchor','Link','Unlink'] //我的按钮的配置,可能和你的不太一样 
21. ] ;  
文件下载:media.rar,解压都已成功。
调试运行时,出现下列问题:

FCKeditor插件:Meida|多媒体插入 上传文件时报告“FCKConfig.MediaUploadAllowedExtensions.length为空或不是对象”,


是怎么回事?有解决的方法吗?

------解决方案--------------------
JScript code
找到media.js,修改

window.onload = function()
{
 // Translate the dialog box texts.
 oEditor.FCKLanguageManager.TranslatePage(document) ;

 // Load the selected element information (if any).
 LoadSelection() ;

 // Show/Hide the "Browse Server" button.
 GetE('tdBrowse').style.display = FCKConfig.MediaBrowser ? '' : 'none';

 // Set the actual uploader URL.
 if ( FCKConfig.FlashUpload )
     GetE('frmUpload').action = FCKConfig.MediaUploadURL;

 window.parent.SetAutoSize( true ) ;

 // Activate the "OK" button.
 window.parent.SetOkButton( true ) ;
}

var oUploadAllowedExtRegex = new RegExp( FCKConfig.MediaUploadAllowedExtensions, 'i' ) ;
var oUploadDeniedExtRegex = new RegExp( FCKConfig.MediaUploadDeniedExtensions, 'i' ) ;

function CheckUpload()
{
 var sFile = GetE('txtUploadFile').value ;
 
 if ( sFile.length == 0 )
 {
  alert( '上传文件不能为空' ) ;
  return false ;
 }
 
 if ( ( FCKConfig.MediaUploadAllowedExtensions.length > 0 && !oUploadAllowedExtRegex.test( sFile ) ) ||
  ( FCKConfig.MediaUploadDeniedExtensions.length > 0 && oUploadDeniedExtRegex.test( sFile ) ) )
 {
  OnUploadCompleted( 202 ) ;
  return false ;
 }
 
 return true ;
}


红色部分是需要修改的地方

------解决方案--------------------
http://www.cnblogs.com/ejiyuan/RecentComments.html