Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Can't Upload File on IIS

I am on a shared-hosting account with GoDaddy it's a windows Server and I am getting this error when attempting to upload a file:

Warning: move_uploaded_file(D:\Hosting\6903\html\pdfs\ALDOmypdfAP.pdf) [function.move-uploaded-file]: failed to open stream: Permission denied in D:\Hosting\6903\html\back.php on line 436

Warning: move_uploaded_file() [function.move-uploaded-file]: Unable to move 'D:\Temp\php\php98C.tmp' to 'D:\Hosting\6903\html\pdfs\ALDOmypdfAP.pdf

I have heard that I can set my php.ini file to change the directory that it's immediately being uploaded to, which would work, however I can't access my php.ini file.

I have tried to create my own php.ini file in the root of my directory, and it causes all sorts of problems, such as not finding the correct MySQL configuration files, goDaddy's support on this was to remove the custom php.ini file, ridiculous, I know.

I have tried to use ini_set like this

ini_set('upload_tmp_dir', 'D:/Hosting/6903/html/pdfs/');

But it hasn't made any effect. Do I have any other options here? Thank you!

UPDATE: From Coda the Octal permissions read 777 of the destination directory.

like image 601
Doug Molineux Avatar asked Feb 25 '23 20:02

Doug Molineux


2 Answers

As far as I know, you need to give the IUSR_MACHINENAME account write permissions specifically on the folder that you are trying to write to, or else it will fail. I don't know what Coda is, but can it allow you to set permissions for specific users?

like image 188
frak Avatar answered Mar 07 '23 17:03

frak


Had the similar problem.

Fixed it by giving all permissions to usergroup "Authenticated User".

It took me couple of hours to realize it. This post kind of gave me the hint.

I hope my share will help others.

like image 41
Talha Avatar answered Mar 07 '23 17:03

Talha