编辑器Ueditor找不到临时文件解决办法
2016-06-28 23:09
387 查看
困扰我多天的问题终于解决了!
对比了多个编辑器,发现还是Ueditor最好用,然后换了服务器之后,Ueditor上传图片的时候总是提示找不到临时文件,上传不成功!
解决办法:
UEditor/ueditor/php/ 目录有个Uploader.class.php的文件,其中upfile()方法如下:
将判断临时文件的部分注释掉:
对比了多个编辑器,发现还是Ueditor最好用,然后换了服务器之后,Ueditor上传图片的时候总是提示找不到临时文件,上传不成功!
解决办法:
UEditor/ueditor/php/ 目录有个Uploader.class.php的文件,其中upfile()方法如下:
/** * 上传文件的主处理方法 * @return mixed */ private function upFile() { $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; }else if (!file_exists($file['tmp_name'])) { $this->stateInfo = $this->getStateInfo("ERROR_TMP_FILE_NOT_FOUND"); return; } else if (!is_uploaded_file($file['tmp_name'])) { $this->stateInfo = $this->getStateInfo("ERROR_TMPFILE"); return; } $this->oriName = $file['name']; $this->fileSize = $file['size']; $this->fileType = $this->getFileExt(); $this->fullName = $this->getFullName(); $this->filePath = $this->getFilePath(); $this->fileName = $this->getFileName(); $dirname = dirname($this->filePath); //检查文件大小是否超出限制 if (!$this->checkSize()) { $this->stateInfo = $this->getStateInfo("ERROR_SIZE_EXCEED"); return; } //检查是否不允许的文件格式 if (!$this->checkType()) { $this->stateInfo = $this->getStateInfo("ERROR_TYPE_NOT_ALLOWED"); return; } // 创建目录失败 if (!file_exists($dirname) && !mkdir($dirname, 0777, true)) { $this->stateInfo = $this->getStateInfo("ERROR_CREATE_DIR"); return; } else if (!is_writeable($dirname)) { $this->stateInfo = $this->getStateInfo("ERROR_DIR_NOT_WRITEABLE"); return; } // 移动文件 if (!(move_uploaded_file($file["tmp_name"], $this->filePath) && file_exists($this->filePath))) { //移动失败 $this->stateInfo = $this->getStateInfo("ERROR_FILE_MOVE"); } else { //移动成功 $this->stateInfo = $this->stateMap[0]; } if( Typecho_Widget::widget('Widget_Options')->plugin('UEditor')->upyun ) { $this->upload2upyun($this->filePath, $this->fullName); } }
将判断临时文件的部分注释掉:
/* else if (!file_exists($file['tmp_name'])) { $this->stateInfo = $this->getStateInfo("ERROR_TMP_FILE_NOT_FOUND"); return; } else if (!is_uploaded_file($file['tmp_name'])) { $this->stateInfo = $this->getStateInfo("ERROR_TMPFILE"); return; }*/
相关文章推荐
- android事件分发(三)重要的函数requestDisallowInterceptTouchEvent
- 《UNIX环境高级编程(第三版)》中apue.h头文件的设置
- 禁止UITextField 使用粘贴复制功能
- (OK) How to access a NAT guest from host with VirtualBox - NAT Port Forwarding
- C#中Dictionary<TKey,TValue>排序方式
- Ring3下Hook NtQueryDirectoryFile隐藏文件
- TypeError: value is out of bounds
- LeetCode - 155. Min Stack
- QQ好友分组添加好友(UITableView实现)
- LeetCode - 232. Implement Queue using Stacks
- 优先级队列:PriorityQueue
- ACM--DP--HDOJ 1005--Number Sequence
- 抗锯齿方法paint.setAntiAlias(ture);paint.setFilterBitmap(true))
- Hibernate 之 初识 uuid 和 native
- vuejs切换视图同时保持状态
- UITableView的基本使用(二)
- HBuilder
- UITableView的基本使用(一)
- serialVersionUID介绍与作用
- UITTableView滑动删除