单独使用fckeditor的文件上传功能
来源:互联网 发布:mac中如何替换ppt模版 编辑:程序博客网 时间:2024/05/18 03:53
单独使用fckeditor的文件上传功能
原文地址:http://blog.csdn.net/vkqiang/article/details/4027865
fckeditor的文件上传功能做的确实不错,但只能在编辑器中使用,有点不爽,今天做了一些修改,完成了对它的单独使用。
fckeditor版本:fckeditor2.6.4
- 1.在web.xml中增加如下内容
<servlet> <servlet-name>FckConnector</servlet-name> <servlet-class> net.fckeditor.connector.ConnectorServlet </servlet-class> <load-on-startup>1</load-on-startup> </servlet> <servlet-mapping> <servlet-name>FckConnector</servlet-name> <url-pattern>/fckeditor/editor/filemanager/browser/default/connectors/jsp/connector </url-pattern> </servlet-mapping>
注意:不要把原来的去掉,如去掉编辑器中的文件上传将不能使用
- 2.修改
fckeditor/editor/filemanager/broswer/default/frmresourceslist.html文件
- 添加一个函数用于获取参数
function GetUrlParam( paramName ){ var oRegex = new RegExp( '[/?&]' + paramName + '=([^&]+)', 'i' ) ; var oMatch = oRegex.exec( window.top.location.search ) ; if ( oMatch && oMatch.length > 1 ) return decodeURIComponent( oMatch[1] ) ; else return '' ;}
- 修改一个函数
function OpenFile( fileUrl ){/* //注释掉的是原来的window.top.opener.SetUrl( encodeURI( fileUrl ).replace( '#', '%23' ) ) ; window.top.close() ; window.top.opener.focus() ;*/ var parent = window.top.opener; if(parent!=null){ parentDocument = parent.document; try{ //获取id,用于决定把值放在那个文本框中 if(parentDocument.getElementById(GetUrlParam("id"))!=null){ parentDocument.getElementById(GetUrlParam("id")).value=fileUrl; } var basePath=parentDocument.getElementById("basePath"); var img=parentDocument.getElementById("imgurl"); if(img != null && basePath !=null) { img.src=basePath.value+fileUrl; } }catch(e){ window.top.close(); } window.top.close(); } if(window.top.opener!=null){ window.top.opener.SetUrl( fileUrl ) ; window.top.close() ; window.top.opener.focus() ; }else{ window.returnValue = fileUrl ; window.top.close() ; } }
- 3.调用
window.open('/fckeditor/editor/filemanager/browser/default/browser.html?Type=Image&Connector=connectors/jsp/connector&id=selectLOGO','','width=600,height=400,left=200,top=200');
参数id是你想要把文件url放在那个文件框的id
0 0
- 单独使用fckeditor的文件上传功能
- 单独使用fckeditor的文件上传功能
- 修改fckeditor的文件上传功能
- 修改fckeditor的文件上传功能
- 修改fckeditor的文件上传功能
- 修改fckeditor的文件上传功能步骤
- 使用ueditor实现单独的图片上传功能
- 使用FormData单独上传文件
- UEditor的配置和使用(单独图片与文件上传)
- 自定义FCKeditor的图片上传功能
- git上传本地单独修改的文件
- Ueditor 1.4.3 单独调用上传图片,或文件功能
- FCKeditor的常用配置方法和无法使用上传功能的解决!
- asp自定义fckeditor上传文件的文件名
- FCKeditor.java+Struts2的上传文件配置
- 借用 FCKEditor 的文件上传/管理界面
- FCKeditor是使用非常广泛的HTML编辑器,本文从 ASP.NET 的使用场景对 FCKeditor 与 FCKeditor.NET 的配置、功能扩展(如自定义文件上传子目录、自定义文件名、上传图片的后期处理等)、以及安全性进行初步的阐述。
- fckeditor - (4)文件上传
- PHP开发中最常见的10个错误
- 目录处理命令(1)
- 语法
- #define宏定义
- UVA-11529(极角排序)
- 单独使用fckeditor的文件上传功能
- Codeforces Round #359 (Div. 2) D DFS
- Servlet学习笔记(Servlet开发过程中的细节:映射、单例、获取配置信息等)
- cocos2d spine 与 tmx相遇崩溃问题
- maven的重新认识
- 二分查找(去哪儿校招题)
- 用php怎么写mysql导出sql文件
- C# webbrowser爬虫中经常碰到的脚本错误弹出窗口的问题解决
- HDU 1312 Red and Black