I'm trying to perform a copy() with Microsoft IIS 5 but i'm gettin permission denied errors. It seems to copy fine when i'm copying to any directory, but I get errors when it is trying to copy in to c:\inetpub\wwwroot and any sub-directories within it. I changed the write permissions in IIS but I'm still getting a permission denied error any ideas?

Here's some code:
if (${"upload".$name} != "") {
if (file_exists("c:/inetpub/wwwroot/myfile.tmp"))
unlink("c:/inetpub/wwwroot/myfile.tmp");
copy(${"upload
".$name}, "c:/inetpub/wwwroot/myfile.tmp");
$value = ${"upload_".$name};
} else
$value = "";

Thanks..
- rob.f

    Hi Rob,

    I've been pulling my hair out today over the same thing.

    Two things made this easy:

    Change your permissions to either 1777 or 757 for the folder you are copying to. 666 appears to work too.

    Make sure that the file doesn't already exist. If it does (as mine did for best part of 3 hours), you get the same message....

    Best of luck,

    StuG

      changing the permissions like that is only for *nix based systems right? i'm using Microsoft IIS. the other thing is, i'm also creating directory and i want to put files in those direcories. would i have to change the permission of those directories created? can i do that through php not through a local admin?

      thanks

      rob.f

        Just tried it on my IIS setup and if you right click on the folder you want to change the permissions on in Windows Explorer, select Properties, scroll down to the Browsers account, click the Advanced button and change the persmissions there, you should be OK.

        Let me know how you get on.

        Later,

        StuG

          Write a Reply...