I encounter an error when copying files inside a directory from another computer in a shared network using PHP. Basically here is the code i am using, the recursive function created by @authorAidan Lister to copy whole directories. It is working on my local machine if I use a local file directory, but when I change it to a directory from another computer it gives me an error concerning permissions.
I am sure that I took care of the permissions concerning folder access because I have gone as far as to allow "Everyone" to be able to have full access to the folder for testing purposes , but it still doesn't work. I am lost and have exhasuted all options I can think of.
PHP is the name of my local machine.
VMSTBOX is the name of the computer with the files i am trying to access.
Also, when I use " chmod("\\VMSTBOX\Users", 0777); "in my PHP code.It also gives me a "permission denied " error. I think this is related to my issue.
I have posted a chunk of my source code below along with the error message below. Thanks for any help
function xcopy($source, $dest, $permissions = 0777)
{
// Check for symlinks
if (is_link($source)) {
return symlink(readlink($source), $dest);
}
// Simple copy for a file
if (is_file($source)) {
return copy($source, $dest);
}
// Make destination directory
if (!is_dir($dest)) {
mkdir($dest, $permissions);
}
// Loop through the folder
$dir = dir($source);
while (false !== $entry = $dir->read()) {
// Skip pointers
if ($entry == '.' || $entry == '..') {
continue;
}
// Deep copy directories
xcopy("$source/$entry", "$dest/$entry", $permissions);
}
// Clean up
$dir->close();
return true;
$filelocation="\\\VMSTBOX\\Files";
$newfilelocation="\\\\PHP\\VarTemptoCopy";
$status = xcopy($filelocation, $newfilelocation);
CODE ENDS HERE
Here is the error message i keep getting.
"Warning: dir(\VMSTBOX\Files,\VMSTBOX\Files): Access is denied. (code: 5) in C:\xampp\htdocs...."