ueditor1.4.3-utf8-php-sae
1:测试环境:SAE(PHP5.6版本)、本地环境
2:SAE相关配置:只需在/ueditor/php/config.json文件下修改saeDomain的配置项,注意大小写,文件保存路径为原有的imagePathFormat配置项

3:本地环境检测:修改/ueditor/php/Uploader.class.php文件第59行为本地环境域名,一般为localhost

4:上传函数源码
/**SAE文件上传处理方法
* @return mixed
* author : think_sae
*
*/
public function saeUpload(){
$file = $this->file = $_FILES[$this->fileField];
if (!$file) {
$this->stateInfo = $this->getStateInfo("ERROR_FILE_NOT_FOUND");
return;
}
if ($this->file['error']) {
$this->stateInfo = $this->getStateInfo($file['error']);
return;
}
$domain=$this->saeDomain;
$this->oriName = $file['name']; //原始文件名
$this->fileSize = $file['size']; //文件大小
$this->fileType = $this->getFileExt(); //文件类型
$path=$this->getFullName();
$getFileName=$path.$name;
$content=file_get_contents($file['tmp_name']); //读取文件内容
$storage = new \SaeStorage(); //SaeStorage类
$url=$storage->write($domain,$getFileName,$content); //写入Storage,返回保存路径
if($url){//上传成功
$this->stateInfo='SUCCESS'; //上传状态信息
$this->fullName = $url; //完整文件名,即从当前配置目录开始的URL
$this->filePath = $this->getFilePath();
$this->fileName = $this->getFileName(); //新文件名
}else{//上传失败
$this->stateInfo=$this->getStateInfo("ERROR_FILE_MOVE");
}
}
源码解读:先使用原有类函数获取编辑器所需属性,然后通过file_get_content函数读取所选文件的内容,再通过SAE内置类SaeStorage的write函数将文件写入storage此方法可能比较笨,如果有更好的方法麻烦指点一下,谢谢