How to upload your files 10 times faster?

by 4 comments
Let's say you want to upload the phpBB script on your server. On many hosts, including GoDaddy, uploading individual, small files takes way much longer than loading one big file.

How to increase the speed of your upload:
1. From all your files and folders, create a zip archive, called upload.zip
2. Create a local file, called upload.php, with the following content.
PHP Code:
<?php 
     
shell_exec("unzip upload.zip"); 
    echo 
"I unzipped all";
?>
3. Upload both upload.zip and upload.php in the desired location
(let's say, in http://yoursite.com/test)

4. Run http://yoursite.com/test/upload.php
to unzip the files on your server.

Compare uploading phpBB (about 1.98 MB - one file) with (7.48 MB = 741 files). By the way, if you download phpBB from phpBB.com, you unzip it and zip it back, you can get a smaller size for the archive.

See also:
How to download your files 10 times faster

#programming #faster #files #times #upload

  • Profile picture of the author zapseo
    Alternatively, with many versions of cpanel, you can use the "file manager".

    By clicking on the file manager and navigating to the zip file you've uploaded, click on the file.

    On the upper-right there will be a "menu" (list of possible actions in text format, not a graphical menu) of possible actions to take with the file, such as move, rename, delete...and... extract.

    You simply click on "extract" -- and whamo! Those files get unzipped faster on my server than they do on my local computer! Blindingly fast.

    Now ... the files that you are uploading...it's probably best that they are stored in their own folder ... you can also not care and just make sure you create a folder on the server side -- but this is "safer".

    So that when you "unzip" the file, it creates a folder and all the other files unzip into that folder.

    Nothing worse than having a gazillion files all unzipped into the top-level folder -- and not even knowing for sure which ones were part of the zip file and which were there previously! Yuk

    Now ... how much time will this save you?

    Well, over 2 years ago, when Butterfly Marketing came out -- owners of the script were informed of this technique as a piece of advice on the forum for Butterfly Marketing Script owners.

    And some people said that piece of advice was worth the price they paid for BFM ($1000+).

    WHY so many script distributors tell you to unzip the distribution file locally and then upload all the individual files via ftp -- is beyond me!
  • Profile picture of the author ForumJoiner
    Originally Posted by zapseo View Post

    WHY so many script distributors tell you to unzip the distribution file locally and then upload all the individual files via ftp -- is beyond me!
    Because some have only FTP access, while for others the method I explained is very complicated.


    cPanel is very good ... if you have it.
    GoDaddy shared hosting accounts don't have cPanel. What do you do only with FTP and no CLI?

    Sergiu FUNIERU
  • Profile picture of the author kidino
    Cool tips you guys ...
  • Profile picture of the author floatingatoll
    Originally Posted by ForumJoiner View Post

    Let's say you want to upload the phpBB script on your server. On many hosts, including GoDaddy, uploading individual, small files takes way much longer than loading one big file.

    How to increase the speed of your upload:
    1. From all your files and folders, create a zip archive, called upload.zip
    2. Create a local file, called upload.php, with the following content.
    PHP Code:
    <?php 
         
    shell_exec("unzip upload.zip"); 
        echo 
    "I unzipped all";
    ?>
    If your shell provider does not provide an unzip executable (or restricts use of the shell_exec() function), you could try using the 'zip' module, if available, to extract the archive. It's linked against zlib, so it should be nearly as fast as the unzip binary - and definitely faster than uploading a million files singly through a web form. The PHP.net documentation for this method has this example. I've added a missing error status check.

    PHP Code:
    <?php
     
    = new ZipArchive;
    if ((
    'upload.zip') === TRUE) {
        if ((
    '/home/username/public_html/destination/') === TRUE) {
            echo 
    'ok';
        } else {
            echo 
    'failed to extract';
        }
        ();
    } else {
        echo 
    'failed to open';
    }
    ?>

Next Topics on Trending Feed