給微贊程式富文字編輯器加上傳附件功能
阿新 • • 發佈:2019-02-16
微贊程式中,新聞編輯中,使用的ueditor,做了定製,去掉了一些按鈕,但是一些情況下需要上傳附件
如果給ueditor加上上傳附件的圖示,
函式所在位置在/web/common/tpl.func.php這個檔案中約985行
作者這個函式中寫的ueditor配置資訊, 上傳附件的按鈕是 'attachment',這個引數
加入這個引數後,實際上傳的配置資訊是沒有配置好的,需要在加入上傳檔案資訊
後臺上傳的動作檔案是在
<script type="text/javascript" src="./resource/components/ueditor/ueditor.config.js"></script>
ueditor/ueditor.config.js中指定的php檔案中的
serverUrl: URL + "php/controller.php"
大家再對這個檔案進行一下加工就可以了
如果給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"
大家再對這個檔案進行一下加工就可以了