Jump to content

rename permission


homer.favenir

Recommended Posts

hi,

ive been working this out all day. searching the web, but no luck..

and i cant find the solution...

does anyone know how can i make this work?


$source = "\\\asecasianas2\\ds_keying\\commonfolder";
$target = "\\\asecasianas2\\ds_archive\\commonfolder";
$x = scandir($source);
$j = 1;
//$x = scandir("c:\\commonfolder");
//print_r($x);

echo "List of Files:" . "<br>";
foreach( $x as $i ){
    if( $i == "." || $i == ".." ){
        //echo $i . "<br>";
    }else{
rename($source."\\".$i, $target."\\".$i);
//copy("c:\\commonfolder\\$i", "d:\\commonfolder\\$i");
echo $j . " file was move : " . " " . $i . "<br>";
$j++;

    }
}

 

im moving files in the server, but the program is in another server.

 

it gives me an error permission.

[function.rename]: Permission denied in C:\xampp\htdocs\keyer_archive\index.php on line 19

 

help please...

 

thanks

Link to comment
https://forums.phpfreaks.com/topic/164512-rename-permission/
Share on other sites

Ah permissions, what a lovely topic!

 

The problem most probably lies (through experience no less) with the user being used to access the specified folders. You will need to find out which user is actually making the requests to those folders, and then give them the modify permission. Of course this isn't going to be easy.

 

If the folder is already readable through your script, then the user should be in the permissions list. Assuming you're running windows (from the c:\), right click on the folder which your script can already read from on the other server, goto the security tab and look at the list of users. If you're using IIS it would be Internet Guest or something similar, on Apache, I think it's the user running the script.

 

It all depends on which user is requesting the interaction. Across a network, it could be a guest account on the local computer (the other server) or even your own account across the network. Hopefully this should give you somewhere to start, let us know how you get on.

 

Good luck!

Link to comment
https://forums.phpfreaks.com/topic/164512-rename-permission/#findComment-867734
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.