How to Transfer Big or Small Files server to server using PHP script

Shortlink:

File transfer server to server

Hi

Today i will teach you how to How to Transfer Big or Small Files server to server using PHP script, this work is very easy, if you’re new user? no tension, It’s very easy, just you will create new file extension is php, example: download.php

Screenshot_5[Note: Must Be you have enabled show file extensions in your computer, if you don’t know how to do this? then you can see this post. How to Show file extensions in my computer]

then open this file any code editor software, like notepad++  then you can copy below code then save it.

<?php
set_time_limit(0); //Unlimited max execution time  
$path = 'backup.zip'; //Path of file where you want to save it on your server
$url = 'http://yourdomain.com/backup.zip'; //Url of file on another server
$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!';
?>

Screenshot_6

 

Now you can see $url = http://yourdomain.com/backup.zip change this link to replace your download link

Then you will upload this file your cPanel>File Managers>public_html location then you will visit your file example: http://yourdomain.com/download.php then automatic download stating your file. when your file downloaded complete then you can see your file your public_html location.

Thank you so much.

Leave a Reply

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

Time limit is exhausted. Please reload CAPTCHA.

Subscribe For Latest Updates

Signup for our newsletter and get notified when we publish new articles for free!




%d bloggers like this: