虽然我尝试使用以下代码在php中move_uploaded_file:
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
我在终端尝试过但没有工作:
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
我仍然得到错误,我正在使用优胜美地,任何其他解决方案?
解决方法:
我的解决方案是通过转到文件>给予images文件夹和php文件的权限.右键单击>获取信息>然后将所有权限更改为读取和写入,如下图所示.