php-chmod():没有这样的文件或目录
发布时间:2020-12-13 16:49:36 所属栏目:PHP教程 来源:网络整理
导读:我试图将图像上传到php服务器,然后使用此文档将图像发送到parse.com: https://parse.com/docs/rest#files 但是在解析中,我只能看到0个大小的图像.我认为问题是文件许可 所以我试图更改文件权限. $target_path = "uploads/"; $img =rand().basename( $_FILES
我试图将图像上传到php服务器,然后使用此文档将图像发送到parse.com:
https://parse.com/docs/rest#files
但是在解析中,我只能看到0个大小的图像.我认为问题是文件许可 所以我试图更改文件权限. $target_path = "uploads/"; $img =rand().basename( $_FILES['image']['name']); $target_path=dirname(__FILE__)."/".$target_path.$img; print($target_path); chmod($target_path,0777); 但在执行此操作时,我收到以下警告 警告:chmod():第15行的/var/www/test/new.php中没有这样的文件或目录 我可以在uploads文件夹中看到该文件.并且文件的所有者是www-data.任何指针 PS:我尝试使用相对路径而不是绝对路径. 解决方法
您通过执行’FILE’来定位脚本文件而不是PATH.
在尝试权限验证之前,请使用“DIR”并验证文件夹是否存在is_dir(). $target_path = "uploads/"; $img =rand().basename( $_FILES['image']['name']); $target_path=dirname(__DIR__)."/".$target_path.$img; print($target_path); chmod($target_path,0777); (编辑:李大同) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |