A Simple Server-to-Server File Transfer Script (PHP)

I’ve used this little script quite a bit while moving servers, and it’s saved me tons of time. It allows you to transfer large files from one server to another by breaking up the file into 1MB pieces to avoid memory limits. There seems to be a 2GB maximum on transfer sizes.

To use it, simply change the variable $path to a relative path on your new server where you want the file to be saved to, change the variable $url to the web-accessible location of the file on the old server, and upload and run the script on your new server.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
<?php
set_time_limit(0); //Unlimited max execution time
 
$path = 'newfile.zip';
$url = 'http://example.com/oldfile.zip';
$newfname = $path;
echo 'Starting Download!<br>';
$file = fopen ($url, "rb");
if($file) {
	$newf = fopen ($newfname, "wb");
	if($newf)
		while(!feof($file)) {
			fwrite($newf, fread($file, 1024 * 8 ), 1024 * 8 );
			echo '1 MB File Chunk Written!<br>';
		}
}
if($file) {
	fclose($file);
}
if($newf) {
	fclose($newf);
}
echo 'Finished!';
?>

Fun In Panama – Horse Crap Roulette

Who said playing with poop can’t be fun?

Horse Crap Roulette Ad

Horse Crap Roulette Ad

Horse Crap Roulette

Horse Crap Roulette

Communist Cat

I found this on the internet and had to share it. Also, test image post, please ignore.

 

Hello world!

This is my new blog. I’ll publish interesting things occasionally, so check back soon!