PHP file upload permissions

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
herod1
Forum Newbie
Posts: 5
Joined: Wed Apr 23, 2003 2:40 am
Location: Sweden

PHP file upload permissions

Post by herod1 »

Hi All

I am trying to upload a file to a local directory and I am getting permission errors. I am using a local server IIS 5 on my XP Pro box. It used to work but I deleted the directory and now I cannot get the permissions correct. They seem fine in IIS (read/write/execute) but I still get this error:

Warning: copy(members/manager.jpg) [function.copy]: failed to create stream: Permission denied in c:\inetpub\wwwroot\prgadvertise.php on line 213

I have tried everything I can think of and now I turn to you for help.

Thanks in advance.
User avatar
oQEDo
Forum Commoner
Posts: 43
Joined: Thu Feb 20, 2003 11:08 am
Location: UK

Post by oQEDo »

Is the directory within one of your webs or is it a seperate windows directory?

If it is a seperate windows directory (ie. c:\uploads\) the easiest thing to do is go into IIS manager and make that directory a virtual web directory, this ensures that the IUSER account has all necessary permissions.

(Also make sure your code is correct as the same error occurs if you do not have the full path specified correctly in your code)
herod1
Forum Newbie
Posts: 5
Joined: Wed Apr 23, 2003 2:40 am
Location: Sweden

Post by herod1 »

Thanks for the response. The directory is shared under inetpub\wwwroot

I have read through many of the other posts on various forums for people experiencing the same problems, and many mention the IUSR permissions but I cannot find anywhere on XP Pro where I can assign user this user permission to the directory.

I tried looking at Security and Sharing but there is nothing to do with users there :cry:
User avatar
oQEDo
Forum Commoner
Posts: 43
Joined: Thu Feb 20, 2003 11:08 am
Location: UK

Post by oQEDo »

In XP pro there is a setting something like "Use Simple Folder Security", if this is set then you will not get the security tab when you right click a folder and choose properties.
Check this is not set (I think you will find it on windows explorer under tools - options)
herod1
Forum Newbie
Posts: 5
Joined: Wed Apr 23, 2003 2:40 am
Location: Sweden

Post by herod1 »

Hi oQEDo

Thank you very much indeed! When you said that, it triggered something in my memory about having to do that before.

I changed the security settings, got access to the user accounts, changed the folder permissions to read/write/execute for the IUSER and it now works fine.

Can't thank you enough as I would have stressed out eventually.
User avatar
oQEDo
Forum Commoner
Posts: 43
Joined: Thu Feb 20, 2003 11:08 am
Location: UK

Post by oQEDo »

No probs :lol:
Post Reply