Unable to upload file to IIS

I am in a shared hosting account with GoDaddy, this is Windows Server and I get this error when trying 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 heard that I can install the php.ini file to change the directory that it downloaded immediately, which will work, but I can’t access the php.ini file.

I tried to create my own php.ini file in the root directory of my directory, and it causes all kinds of problems, for example, not finding the correct MySQL configuration files, goDaddy support in this is to delete the custom php. ini file, funny, I know.

I tried using ini_set like this

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

But this did not affect. Do I have other options here? Thanks!

UPDATE: 777 of the target directory are read from Coda Octal permissions.

+4
source share
5 answers

As far as I know, you need to grant write permissions to the IUSR_MACHINENAME account specifically for the folder you are trying to write to, or else it won’t succeed. I don’t know what Coda is, but can it allow you to set permissions for certain users?

+4
source

There was a similar problem.

It is fixed by providing all permissions for the Authenticated User group of users.

It took me a couple of hours to figure this out. This post gave me a hint.

I hope my share helps others.

+2
source

The problem probably comes from the destination destination directory more than the temporary directory.

Usually, if the file cannot be downloaded at all, $_FILES['yourfile']['error'] will be set to UPLOAD_ERR_CANT_WRITE (7). The error message says that the problem is that move_uploaded_file cannot read from the temporary directory (unlikely) or write to the target directory (most likely).

Check and possibly try changing permissions in the destination directory.

0
source

@Talha - "Fixed by providing all permissions for the Authenticated User group of users. This is the only solution that worked. There are no other solutions. Giving permission to IIS_USR, NETWORK user, etc. Nothing worked.

Thanks for the decision

0
source

Maybe this might help ...

  • Find and open php.ini in the PHP folder (in my case c:\Program files(86)\PHP )

  • Find the word upload_tmp_dir and do one of two upload_tmp_dir

- Positivity 1

3.1 Set upload_tmp_dir = "[Some folder with full permission for IUSR user]"

- Positivity 2

3.2 Search in Windows Explorer for the folder set in upload_tmp_dir (In my case, C:\WINDOWS\Temp )

3.2.1 Right-click on C:\WINDOWS\Temp β†’ Properties β†’ Security β†’ β€œEdit” button β†’ β€œAdd”, then add the IUSR user and set the full permissions for this β†’ β€œAccept”.

I think this might help someone.

0
source

All Articles