给微赞程序富文本编辑器加上传附件功能

微赞程序中,新闻编辑中,使用的ueditor,做了定制,去掉了一些按钮,但是一些情况下需要上传附件
如果给ueditor加上上传附件的图标,


富文本编辑的调用是使用了以下函数的


function tpl_ueditor($id, $value = '', $options = array()) {

函数所在位置在/web/common/tpl.func.php这个文件中约985行
作者这个函数中写的ueditor配置信息, 上传附件的按钮是 'attachment',这个参数
加入这个参数后,实际上传的配置信息是没有配置好的,需要在加入上传文件信息

var ueditoroption = {
				 
				'autoClearinitialContent' : false,
				'toolbars' : [['fullscreen', 'source', 'preview', '|', 'bold', 'italic', 'underline', 'strikethrough', 'forecolor', 'backcolor', '|',
					'justifyleft', 'justifycenter', 'justifyright', '|', 'insertorderedlist', 'insertunorderedlist', 'blockquote', 'emotion', 'insertvideo', 'attachment',
					'link', 'removeformat', '|', 'rowspacingtop', 'rowspacingbottom', 'lineheight','indent', 'paragraph', 'fontsize', '|',
					'inserttable', 'deletetable', 'insertparagraphbeforetable', 'insertrow', 'deleterow', 'insertcol', 'deletecol',
					'mergecells', 'mergeright', 'mergedown', 'splittocells', 'splittorows', 'splittocols', '|', 'anchor', 'map', 'print', 'drafts']],
				'elementPathEnabled' : false,
				'initialFrameHeight': {$options['height']},
				'focus' : false,
				'maximumWords' : 9999999999999,
				'fileActionName': 'uploadfile',  

'fileFieldName': 'upfile',  
'filePathFormat': '../../upload/file/{yyyy}{mm}{dd}/{time}{rand:6}', 
'fileUrlPrefix': '', 
'fileMaxSize': 51200000,  
'fileAllowFiles': [
'.png', '.jpg', '.jpeg', '.gif', '.bmp',
'.flv', '.swf', '.mkv', '.avi', '.rm', '.rmvb', '.mpeg', '.mpg',
'.ogg', '.ogv', '.mov', '.wmv', '.mp4', '.webm', '.mp3', '.wav', '.mid',
'.rar', '.zip', '.tar', '.gz', '.7z', '.bz2', '.cab', '.iso',
'.doc', '.docx', '.xls', '.xlsx', '.ppt', '.pptx', '.pdf', '.txt', '.md', '.xml'
],  

			};

后台上传的动作文件是在
<script type="text/javascript" src="./resource/components/ueditor/ueditor.config.js"></script>
ueditor/ueditor.config.js中指定的php文件中的
serverUrl: URL + "php/controller.php"
大家再对这个文件进行一下加工就可以了
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值