简体   繁体   中英

move_uploaded_file(…): failed to open stream: Permission denied in… Using Mac OS X Mountain Lion

So basically I have your classic 'move_uploaded_file' statement:

move_uploaded_file($_FILES['image']['tmp_name'], 'files/' . $_FILES['image']['name']);

But I am getting this on my OS X Mountain Lion:

move_uploaded_file(...): failed to open stream: Permission denied in... 

How can I change the permissions so I can move it?

in MAC OS X's terminal ,use this commande :

  CHMOD 775 yourFilesPath

775:Standard file sharing mode for a group.

First thing to note down since you are using xamp server which have the Application folder in Root

/Applications/XAMPP/xamppfiles/htdocs/emp/files/admin_assets/addsdassets

so for uploading the image file you have to provide the target directory which should be present in the Root try with the same directory in which application is running

And then locate the xamp server location by clicking on show original on the mac after right click and then change 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.

在此处输入图片说明

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM