3.2.1版本 文件上传 发现的问题

浏览:898 发布日期:2014/07/08 分类:技术分享 关键字: rootPath upload 上传
ThinkPHP/Library/Think/Upload/Driver/Local.class.php文件中 38行 :
checkRootPath 方法
直接使用 is_dir 和 is_writable 检查 $this->rootPath 时,如果实例化 upload类时,rootPath属性设置为空 上传时提示错误:“上传根目录不存在!请尝试手动创建”。
修改方法:
if(!(is_dir($this->rootPath) && is_writable($this->rootPath))){
修改为:
if($this->rootPath != '' && !(is_dir($this->rootPath) && is_writable($this->rootPath))){

就是在if里面 最前面加上 rootPath不为空时,就能成功上传文件了
最佳答案
评论( 相关
后面还有条评论,点击查看>>