ThinkPHP做的,部署在IIS上,上传图片报“上传目录不可写”

WBOY
Release: 2016-06-23 14:38:34
Original
1247 people have browsed it

public function upload() {        //导入图片上传类        import("ORG.Net.UploadFile");        //实例化上传类        $upload = new UploadFile();        $upload->maxSize = 3145728;        //设置文件上传类型        $upload->allowExts = array('jpg','gif','png','jpeg');        //设置文件上传位置        $upload->savePath = __ROOT__.'/Public/Uploads/Images/';        //设置文件上传名(按照时间)        $upload->saveRule = "time";        if (!$upload->upload()){            $this->error($upload->getErrorMsg());        }else{            //上传成功,获取上传信息            $info = $upload->getUploadFileInfo();        }        $savename = $info[0]['savename'];        $url = $savename;        //保存表单数据,包括上传的图片        $model = M("pkxs");        if (false === $model->create ()) {            $this->error ( $model->getError () );        }        // 更新数据        $list=$model->save ();        if (false !== $list) {            //成功提示            $this->assign ( 'jumpUrl', Cookie::get ( '_currentUrl_' ) );            $this->success ('编辑成功!');        } else {            //错误提示            $this->error ('编辑失败!');        }    }
Copy after login

代码中的目录是存在的,我在IIS中也将整个“Uploads”文件夹及子文件夹都赋了“写入”权限,为什么还是提示“上传目录/WEB/WPM/Public/Uploads/Images/不可写”呢?


回复讨论(解决方案)

你的上传目录是在网站中吗?
如果是,需要在 iis 管理其中勾选“写入”

从根起到你的上传目录,路径名中不能有中文
windows 的默认字符集是 gbk,而 TP 是 utf-8 的

对于非 iis 管理的文件夹仅有写入权限是不够的,还需在高级选项卡中勾选 允许存档

你的上传目录是在网站中吗?
如果是,需要在 iis 管理其中勾选“写入”

从根起到你的上传目录,路径名中不能有中文
windows 的默认字符集是 gbk,而 TP 是 utf-8 的

对于非 iis 管理的文件夹仅有写入权限是不够的,还需在高级选项卡中勾选 允许存档

请问版主,我要将我的整个项目目录勾选“写入”?还是只是将上传目录勾选“写入”呢?

关于中文路径是没有的。

iis 的配置都是针对整个网站的

我找到原因了,不是IIS配置的问题,是上传目录文件夹的Users的写入权限没给。

还是要多谢版主!结贴给分!

source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!