• Resolved Rehan ur Rashid

    (@rehanurrashid)


    Hi,

    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.
    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

Viewing 4 replies - 1 through 4 (of 4 total)
  • I provide the shared folder path but it didn’t works

    Is everything under the same server? Wouldn’t be easier to use Rsync

    Thread Starter Rehan ur Rashid

    (@rehanurrashid)

    both computers using localhost-> xamp -> apache server

    I want to Sync 1st computer directory with 2nd computer
    When someone uploads the file on 2nd computer, a specific directory will automatically be synced on the 1st computer, that’s the problem statement.

    Can I resolve this problem using Rsync?

    Thanks

    Can I resolve this problem using Rsync?

    Well yes. Each time a new file appears, RSYNC will copy it to the folder desired, but not under your current setup with XAMPP

    Thread Starter Rehan ur Rashid

    (@rehanurrashid)

    Thanks for your help, issue resolved.

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Upload file to share folder/ map folder’ is closed to new replies.