I want to upload a file from one machine to another server ie application is in server A and path of the uploaded file is in server B. How can I implement this without using curl, ftp and ssh. The code which I have used is shown below. But it is not working

<form action="" method="post" enctype="multipart/form-data">
   <input type="file" name="vchr_req_upload" id="vchr_req_upload" />
    <input type="hidden" name="key" value="asdf1234sadfasfd34565xx" />
    <input type="submit" name="submit"> 


    echo $filename=basename($_FILES['vchr_req_upload']['name']);
        $path_info = pathinfo($filename);

             $target_path = "";

            if ($_FILES["vchr_req_upload"]["error"] > 0)
                echo "Apologies, an error has occurred.";
                echo "Error Code: " .$_FILES["vchr_req_upload"]["error"];




move_uploaded_file does not work across servers. Depending on your servers' configuration, you may be able to use file_put_contents.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, learning, and sharing knowledge.