本文介绍了move_uploaded_file 无法打开流:权限被拒绝 - Mac的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当我尝试使用以下代码在 php 中 move_uploaded_file 时:

While i am trying to move_uploaded_file in php with following code :

if(is_uploaded_file($_FILES['fileupload2']['tmp_name'])){

        move_uploaded_file($_FILES['fileupload2']['tmp_name'], "images/".$_FILES['fileupload2']['name']);

    }

我收到此错误消息:

Warning: move_uploaded_file(images/VIDEO_TS.VOB): failed to open stream: Permission denied in /Applications/XAMPP/xamppfiles/htdocs/Week3/Lesson2/do_upload.php on line 24

我在终端中尝试过,但没有成功:

i tried in the terminal and didn't work:

sudo CHMOD 775 /Applications/XAMPP/xamppfiles/htdocs/Week3/Lesson2/do_upload.php

sudo chmod -R 0755 /Applications/XAMPP/xamppfiles/htdocs/Week3/Lesson2/do_upload.php

sudo chown nobody /Applications/XAMPP/xamppfiles/htdocs/Week3/Lesson2/do_upload.php

我仍然遇到错误,我正在使用 Yosemite,还有其他解决方案吗?

I am still getting the error and i am using Yosemite, any other solution ?

推荐答案

我的解决方案是通过转到文件>右键单击>获取信息>然后更改所有图像文件夹和php文件的权限权限read&write如下图.

My solution was to give the permission for the images folder and the php file, by going to the file > Right click > Get info > and then change all the permissions to read&write as the following picture.

这篇关于move_uploaded_file 无法打开流:权限被拒绝 - Mac的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

07-18 05:27
查看更多