我要评论
前言
在使用UEditor编辑器时,一般我们都是需要修改默认的图片上传路径的,下面是我整理好的修改位置和方法供大家参考。
操作
Ueditor PHP版本本身自带了一套上传程序,我们可以在此基础中,找到配置文件修改它。配置文件位置:
ueditor/php/config.json
内容如下:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 |
{ "imageActionName" : "uploadimage" , "imageFieldName" : "upfile" , "imageMaxSize" : 2048000, "imageAllowFiles" : [ ".png" , ".jpg" , ".jpeg" , ".gif" , ".bmp" ], "imageCompressEnable" : true , "imageCompressBorder" : 1600, "imageInsertAlign" : "none" , "imageUrlPrefix" : "" , "imagePathFormat" : "/ueditor/php/upload/image/{yyyy}{mm}{dd}/{time}{rand:6}" , "scrawlActionName ": " uploadscrawl ", " scrawlFieldName ": " upfile ", " scrawlPathFormat ": " /ueditor/php/upload/image/{yyyy}{mm}{dd}/{time}{rand:6} ", " scrawlMaxSize ": 2048000, " scrawlUrlPrefix ": " ", " scrawlInsertAlign ": " none ", " snapscreenActionName ": " uploadimage ", " snapscreenPathFormat ": " /ueditor/php/upload/image/{yyyy}{mm}{dd}/{time}{rand:6} ", " snapscreenUrlPrefix ": " ", " snapscreenInsertAlign ": " none ", " catcherLocalDomain ": [" 127.0.0.1 ", " localhost ", " img.baidu.com "], " catcherActionName ": " catchimage ", " catcherFieldName ": " source ", " catcherPathFormat ": " /ueditor/php/upload/image/{yyyy}{mm}{dd}/{time}{rand:6} ", " catcherUrlPrefix ": " ", " catcherMaxSize ": 2048000, " catcherAllowFiles ": [" .png ", " .jpg ", " .jpeg ", " .gif ", " .bmp "], " videoActionName ": " uploadvideo ", " videoFieldName ": " upfile ", " videoPathFormat ": " /ueditor/php/upload/video/{yyyy}{mm}{dd}/{time}{rand:6} ", " videoUrlPrefix ": " ", " videoMaxSize ": 102400000, " videoAllowFiles ": [ " .flv ", " .swf ", " .mkv ", " .avi ", " .rm ", " .rmvb ", " .mpeg ", " .mpg ", " .ogg ", " .ogv ", " .mov ", " .wmv ", " .mp4 ", " .webm ", " .mp3 ", " .wav ", " .mid "], " fileActionName ": " uploadfile ", " fileFieldName ": " upfile ", " filePathFormat ": " /ueditor/php/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 " ], " imageManagerActionName ": " listimage ", " imageManagerListPath ": " /ueditor/php/upload/image/ ", " imageManagerListSize ": 20, " imageManagerUrlPrefix ": " ", " imageManagerInsertAlign ": " none ", " imageManagerAllowFiles ": [" .png ", " .jpg ", " .jpeg ", " .gif ", " .bmp "], " fileManagerActionName ": " listfile ", " fileManagerListPath ": " /ueditor/php/upload/file/ ", " fileManagerUrlPrefix ": " ", " fileManagerListSize ": 20, " fileManagerAllowFiles ": [ " .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" ] } |
从config.json内容中,我们不难看出(全部都有注释,看不出就见鬼了->_->),几乎所有的上传配置都是在这里。如果想修改上传路径,那么通过修改文件第 12 行就可以做到。
比如,这里我们修改 imagePathFormat :
保存,上传,测试,查看源码:
此时可以看出,修改是成功的。
总结
上传配置这款,会因ueditor版本不同,而稍有不同,我刚开始在用新版本时也没有反应过来,寻根索源才找到了这里,大家在修改的时候也要注意下哦。
另外,如果需要修改其他上传,如视频等,也可以在此处文件修改,道理都是一样的。
发布者:全栈程序员-用户IM,转载请注明出处:https://javaforall.cn/114401.html原文链接:https://javaforall.cn
【正版授权,激活自己账号】: Jetbrains全家桶Ide使用,1年售后保障,每天仅需1毛
【官方授权 正版激活】: 官方授权 正版激活 支持Jetbrains家族下所有IDE 使用个人JB账号...