[英]move_uploaded_file failed to open stream: Permission denied Mac
I want to upload an image.我想上传一张图片。 Every time I try to upload the image I recieve the error message found below.每次我尝试上传图像时,我都会收到下面的错误消息。
I have already set the permissions to read&write:我已经设置了读写权限:
Warning: move_uploaded_file(uploads/1000020170620022532img3.png): failed to open stream: Permission denied in /Applications/XAMPP/xamppfiles/htdocs/social-network-master/profile.php on line 41警告:move_uploaded_file(uploads/1000020170620022532img3.png):无法打开流:第 41 行的 /Applications/XAMPP/xamppfiles/htdocs/social-network-master/profile.php 中的权限被拒绝
Warning: move_uploaded_file(): Unable to move '/Applications/XAMPP/xamppfiles/temp/phpYqSkvp' to 'uploads/1000020170620022532img3.png' in /Applications/XAMPP/xamppfiles/htdocs/social-network-master/profile.php on line 41警告:move_uploaded_file():无法将“/Applications/XAMPP/xamppfiles/temp/phpYqSkvp”移动到“uploads/1000020170620022532img3.png”在/Applications/XAMPP/xamppfiles/htdocs/social.phpnetwork-line-profile 41
Friend, You only need only to create the directory where are your .php file is found:朋友,您只需要创建您的 .php 文件所在的目录:
uploads/上传/
And change the Only write in the folder并更改只在文件夹中写入
Please use below code:请使用以下代码:
move_uploaded_file($_FILES['image']['tmp_name'],'uploads/1000020170620022532img3.png');
If this code is not working please check path and folder permission.如果此代码不起作用,请检查路径和文件夹权限。
try this in terminal在终端试试这个
sudo chmod -R 777 upload/
ps got to the upload directory and run sudo chmode -R 777 directly. ps 进入上传目录并直接运行sudo chmode -R 777 。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.