Skip to content

Instantly share code, notes, and snippets.

@muddy-28
Last active October 15, 2019 18:42
Show Gist options
  • Save muddy-28/c2c3ea058cb457e7ea3fb39796da99b5 to your computer and use it in GitHub Desktop.
Save muddy-28/c2c3ea058cb457e7ea3fb39796da99b5 to your computer and use it in GitHub Desktop.
How to transfer large files from one server to another in seconds
<html>
<head>
<title>How to transfer large files from one server to another in seconds - EagaleSolutions</title>
</head>
<body>
<form method="post">
<input name="url"size="50" placeholder="http://abc.pk/Muqas.zip" />
<input name="submit" type="submit" />
</form>
<?php
set_time_limit (24 * 60 * 60);
if (!isset($_POST['submit'])) die();
// $destination_folder = 'download/';
$url = $_POST['url'];
$newFile = basename($url);
$file = fopen ($url, "rb");
if ($file) {
$newf = fopen ($newFile, "wb");
if ($newf)
while(!feof($file)) {
fwrite($newf, fread($file, 1024 * 8 ), 1024 * 8 );
}
}
if ($file) {
fclose($file);
}
if ($newf) {
fclose($newf);
}
?>
</body>
</html>
@muddy-28
Copy link
Author

How to use:

  1. Create a new file on your destination server. Say, file.php
  2. Copy the code above and paste it to file.php
  3. Go to your source server via file manager/FTP. Zip entire site.
  4. Run your file.php and give the URL of zipped file of the source. Click Submit. Wait for seconds till the page reloads.
  5. Go to destination server. Amazing! The file is here! Unzip it.
  6. You are done! It’ll take dramatically very small time!

Note: if you wish to move the files to a specific folder in the destination, just ‘uncomment’ line# 13 and replace download with your own folder name.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment