Remote Upload PHP Script

Remote Upload (Server to Server File Copy) PHP Script

On this post we show you how to Copy a file Or Remote upload from server to server, means we can copy a file from Server A to Server B.

Lets start:

1). First we create a php file and paste below code on it.

<?php
//Get the file
$content = file_get_contents("http://www.ServerA.com/file1.zip");
//Store in the filesystem.
$fp = fopen("/home/dirname/public_html/file1.zip", "w");
fwrite($fp, $content);
fclose($fp);
?>

2). Change http://www.ServerA.com/file1.zip to your domain name or server ip with file location which we want to copy on another server. Where file1 is your file and .zip is your file extension.

3). Now change /home/dirname/public_html/file1.zip according to your cPanel path. For more information about this path, login to your cPanel and have a look on it. Here dirname is a short name of your domain name and file1.zip is our file which we want a copy from ServerA. Make sure this file (here we use file1.zip) name and its extension is same as ServerA file.

3). Now upload this file on your server or web hosting and browse this file "index.php".

For example:

According to this post i visit http://ServerA.com/ and by default i see index.php page. The web page is blank, please wait few minutes and now check your required file using FTP program or File Manager of cPanel.

That's it, we just do it.

Note: Please note that this trick doesn't work with dynamic URL's i.e., rapidshare or another file hosting website's.

MrHitech Author

The Guest's post, tutorial and FAQ (s) will be updated through this account. For any query/suggestion please feel free to contact us. We're on: @Facebook @twitter @Google+ @Linkedin @Youtube