Wednesday, October 31, 2018

Transfer file remotely (Server to Server)

Transfer file remotely (Server to Server)

<?php
define('BUFSIZ', 4095);
$url = 'http://www.remoteserveraddress.com/test.zip';
$rfile = fopen($url, 'r');
$lfile = fopen(basename($url), 'w');
while(!feof($rfile))
fwrite($lfile, fread($rfile, BUFSIZ), BUFSIZ);
fclose($rfile);
fclose($lfile);
?>


Step 1: First you will need to add a file called remoteupload.php where you want to upload the files.
Paste the above code in that file.
Step 2: Replace the url with your url required to be remotely upload.
Step 3 : Run the file remoteupload.php and it will automatically copy your requested files in a fraction of second.
Hope this is helpful for you.



No comments:

Post a Comment