I have two computers C1 and C2 both computers running the same WordPress website and connected to each other using a switch. I can access C1 from C2 in Networks.
I am using a custom plugin in which I am uploading files, each computer upload files in their specific folder, uploads/XYZ.
What I want is to save the uploaded file of C2 to C1 uploads/XYZ folder. So that I can access uploaded files from C1 and I don't need to go to the C2.
Right now I share and give all permissions to the /XYZ folder of C1 and this folder is accessible from C2.
In my code, I provide the shared folder path but it didn’t works, also I made the shared folder as a mapped drive it also not works.
Here is my code:
$upload_dir = ‘\\C1\XYZ’;
if(!is_dir($upload_dir))
mkdir($upload_dir);
$img = $_POST[‘form1_data1’];
$name = $_POST[‘form1_data2’];
$img = str_replace(‘\\’, ”, $img);
$file = $upload_dir .’/’. $name . “.svg”;
$success = file_put_contents($file, $img);
echo $name;
die();
Appreciate your help. Thanks