Remote Server Transfer using php

In this tutorial I am going to explain how to transfer large files from one server to another without any time lag.

It is a hell job to download and then upload files while at the time of server transfer.In this we can use an alternative called remote upload.

Most of the servers support remote upload.But in some hosting providers like silliconhouse.net doesn’t support remote file transfer.If it is not supporting the server transfer will be a hell job.

Here is the code for Remote Upload files using Php:

<?php
define('BUFSIZ', 4095);
$url = 'https://www.navaneeth.me/alexa-top-ranks.csv.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 need to create a file called upload.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 upload.php and it will automatically copy your requested files in a fraction of second.

Hope this is helpful for you.
Enjoy the Remote Uploading using php.

Leave a Reply

Your email address will not be published. Required fields are marked *