Getting move_uploaded_file to work

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
LonelyProgrammer
Forum Contributor
Posts: 108
Joined: Sun Oct 12, 2003 7:10 am

Getting move_uploaded_file to work

Post by LonelyProgrammer »

Hi all...

Whenever I try to use move_uploaded_file to move an uploaded file to a directory, it gives me this error:

Code: Select all

Moving file to C:\Inetpub\wwwroot\eknowledge\quizmedia\quiz10....
Warning: move_uploaded_file(C:\Inetpub\wwwroot\eknowledge\quizmedia\quiz10): failed to open stream: Permission denied in C:\Inetpub\wwwroot\eknowledge\quiz_manager.php on line 586
I made sure the directory exists (heck, I even create it if it doesn't!) but still can't get it to work. Any clue?

Thanks in advance.
Stoneguard
Forum Contributor
Posts: 101
Joined: Wed Aug 13, 2003 9:02 pm
Location: USA

Post by Stoneguard »

you have to make sure your IUSR_<compname>, which is your anonymous login id has create/write access to that directory. Which operating system is it? You need to go to that directory in a windows explorer, right click, select the security tab and add the IUSR access permissions.
LonelyProgrammer
Forum Contributor
Posts: 108
Joined: Sun Oct 12, 2003 7:10 am

Post by LonelyProgrammer »

Sorry for not being specific...

I am using Windows 98 as my developing platform and using Personal Web Manager. Do I have to add the upload directory as a virtual directory?
Stoneguard
Forum Contributor
Posts: 101
Joined: Wed Aug 13, 2003 9:02 pm
Location: USA

Post by Stoneguard »

I havent used win 98 in a long time. I am not sure ow security works under it, but you need the permissions set properly onthe directory you are writing to.
User avatar
markl999
DevNet Resident
Posts: 1972
Joined: Thu Oct 16, 2003 5:49 pm
Location: Manchester (UK)

Post by markl999 »

Might also be worth trying it without the c: bit, i.e just '\Inetpub\wwwroot\eknowledge\quizmedia\quiz10' as i;ve seen using drive/partition names cause problems before.

Most web servers allow you to use unix style paths too, so might also try using
'/Inetpub/wwwroot/eknowledge/quizmedia/quiz10' in both the uploaded paths.
Post Reply