[php] 2024-04-25 圈点547
摘要:umeditor编辑器配置图片上传路径,及php处理文件路径的说明。
1,修改imageUp.php文件
找到:"savePath" => "upload/"
修改为:"savePath" => "/public/images/" 这里是相对于根目录的绝对路经;两边都加/
2,找到:$Path = "upload/";
修改为:$Path = /public/images/";
3,在umeditor.comfig.js文件的大约第140行,
找到:imagePath:URL + "php/"
修改为:imagePath:"http://127.0.0.1"
4,修改Uploader.class.php
a),在函数getFileInfo()中的第一行添加如下代码:
$this->fullName=strstr($this->fullName,"/public/images");
b),在函数getFolder()中的$pathStr = $this->config[ "savePath" ],这一行后边添加
$myappfile="thinkphp"; //不包括任何/ 的网站根目录的文件夹名称
$myfilepath = str_replace('\\', '/', dirname(__FILE__));//此文件路经,无/
$myapppath = substr($myfilepath,0,strpos($myfilepath,$myappfile)).$myappfile;//末尾无/ 此为网站根目录的绝对路经
$pathStr = $myapppath . $pathStr;
这里可以对处理的php文件路径进行修改(也可以不修改):
在umeditor.comfig.js文件的大约第140行,
找到:imageUrl:URL+"php/imageUp.php"
修改为:imageUrl:"/imageUp.php" //"/imageUp.php"是imageUp.php对应的路经;
在imageUp.php中
找到:include "Uploader.class.php";
修改为:include "Uploader.class.php"; //"Uploader.class.php" 是Uploader.class.php对应于imageUp.php的路经;