Writing file to another server

I am trying to go about a new way of putting a file on another server. The code to put the file on the webserver folder works fine, but when I try to put it on a different folder it errors out. I’m assuming this has to do with permissions on the other server, but I’m not sure what I need to change in order to get the file to be put on the other server.

now write the data to the webserver
$fileName = date(“Ymd”)."_".$SESSION[“storeid”]."".$orderid.".txt";
$filePath = “c:\webserver\folder\folder\” . $fileName;
$handle = fopen($filePath, “w”);
if (fwrite($handle, $import_file_data) === FALSE) {
echo “Cannot write to webserver ($fileName)”;
exit;
}
fclose($handle);

Above works fine.

// now write the data to the another server
$fileName = date(“Ymd”)."_".$SESSION[“storeid”]."".$orderid.".txt";
$filePath = “\\server\c$\folder\folder\” . $fileName;
$handle = fopen($filePath, “w”);
if (fwrite($handle, $import_file_data) === FALSE) {
echo “Cannot write to server ($fileName)”;
exit;
}
fclose($handle);

Above errors out.

Error: 1
Warning: fopen(\server\c$\folder\folder\filename.txt) [function.fopen]: failed to open stream: No such file or directory in C:\file.php on line 645 (line in red)

Warning: fwrite(): supplied argument is not a valid stream resource in c:\file.php on line 647
Cannot write to server (filename.txt) (line in blue)

Please help!!!

Sponsor our Newsletter | Privacy Policy | Terms of Service