How To: Transfer large files between servers
I find myself in the position where I need to move a website from one host to another. Unfortunately, the /public_html/ backup is just under 1Gb. This means about 45 minutes to download this file, and then probably the rest of my 30′s to upload it to the new server. So – pray do tell – how do we transfer large files From one server to another without downloading and uploading?
Create the following php file in the directory where you want to move the large file to. Replace the URL with the URL to the file you want to move to the new location, and save the file as ‘upload.php’. Now, simply open your newly created file in a browser, and wait for it to load. Once you see the message “File Transfer Complete – your large file will be copied over.
php define('BUFSIZ', 4095); $url = ''; $rfile = fopen($url, 'r'); $lfile = fopen(basename($url), 'w'); while(!feof($rfile)) fwrite($lfile, fread($rfile, BUFSIZ), BUFSIZ); fclose($rfile); fclose($lfile); ?>
File Transfer Complete
Important Remember to add the URL to your .zip file in this section:
$url = '';