I am trying to write create a file using move function. Android app is calling an API and sending image files. but on server side I am getting "Unable to write a file on \x.x.x.x\test folder.
Below code snippet is from production server which written in larvael.
$file_upload = $file_name->move(env('SHARE_PATH'),$old_filename);
I am now trying to test share file folder access using core php function.When I write a file using fopen , I am getting success. But when I use is_readable function , it returns "False" instead of "True".
error_reporting(E_ALL);
$dir = "\\\\x.x.x.x\\transitory";
if(is_readable('\\\\x.x.x.x\\transitory\\')) {
var_dump("$old_filename is readable");
} else {
var_dump("$old_filename is not readable");
}
if(is_writable('\\\\x.x.x.x\\transitory\\')) {
var_dump("$old_filename is writable");
} else {
var_dump("$old_filename is not writable");
}
if (is_dir($dir))
{
if ($dh = opendir($dir))
print "able to access directory tree.";
$myfile = fopen($dir."\\newfile1.txt", "w") or die("Unable to open file!");
$txt = "John Doe\n";
fwrite($myfile, $txt);
$txt = "Jane Doe\n";
fwrite($myfile, $txt);
fclose($myfile);
}
else { print "not access tree.";}
Output
string(16) " is not readable"
string(16) " is not writable"
string(13) "readdir false"
able to access directory tree.
Expected Result.. ABove code shoud return True and want to move a file from temp folder to shared folder.
EDIT --
It runs on IIS server and server has an access to this shared folder