Big File Uploads

There is more than one way to get a file onto a website: a simple upload form, an FTP client, or — in years past — a Flash uploader.

As the owner of the site, with administrator rights, you can use any of them. Once you want your visitors to upload files, the options narrow. FTP is out: you are not going to hand out server credentials. Flash is out too — browsers dropped support for it in 2020.

What remains is the HTML upload form, which is about as plain as an interface gets:

A simple HTML upload form with a Browse button and a Send button

Press Browse, choose your files, press Send, and up they go.

Why big files fail

HTML upload forms have a real limitation: web servers cap how large an upload may be and how long it may take. “Large” here starts somewhere around 50 MB, though it depends entirely on the server and on how fast the visitor’s connection is.

Sometimes raising a couple of PHP settings — upload_max_filesize and max_input_time — is enough. Often it is not: on shared hosting you may not be allowed to change them at all, and a slow connection will still run out of time. So how do your visitors upload big files?

The solution: chunked uploads

HTML5 brought, among much else, the ability to slice a file up in the browser before sending it. A big file can be cut into pieces, the pieces sent one at a time, and the file reassembled on the server once they have all arrived. Make the pieces small enough — a megabyte, say — and no server will object to any of them. The size of the original file stops mattering, whether it is 1 GB or considerably more.

This is called chunked upload. Implementing it properly is fiddly, but it brings three real advantages:

  • Files of unlimited size can be uploaded — bounded only by the file system, or by the storage the server has left.
  • Checks that run before a file is saved — its extension, or whether its name matches some pattern — need only the first chunk, not the whole file.
  • Uploads can resume. If the connection drops halfway through, the upload picks up where it stopped instead of starting again.

There are technical write-ups of how to build this, but they assume solid programming experience and a good understanding of how uploads work. The practical answer for most sites is a tool that has already done it.

Further reading

Did this solve your problem?

5 discussions

Most recent: February 2019

Questions answered by Iptanus and other users.

  1. Pls remove comment re: “file > 10Mb upload still fails with Pro”
    “Chunk” mode is disabled by default (consider changing),.
    Now enabled and works fine.
    Good plugin, very useful, esp. drag-drop !

  2. Αγαπητέ Νίκο,
    έκανα ατελείωτες προσπάθειες (ακόμη και με ftp) αλλά δεν κατάφερα να το κάνω να δουλέψει στην ιστοσελίδα: http://www.otapractices.gr/%CF%85%CF%80%CE%BF%CE%B2%CE%BF%CE%BB%CE%B7-%CE%BA%CF%80/
    Το shortcode είναι:
    [wordpress_file_upload captcha=”true” uploadpath=”uploads” uploadrole=”all” maxsize=”100″ dublicatespolicy=”maintain both” placements=”userdata/title+selectbutton+filename+uploadbutton/message/captcha/filelist/progressbar” uploadtitle=” Υποβολή αρχείων καλής πρακτικής” selectbutton=” Επιλογή αρχείου/ Επιλογή αρχείων” uploadbutton=”Υποβολή αρχείου/Υποβολή αρχείων” captchaprompt=”Παρακαλούμε συμπληρώστε τους παραπάνω χαρακτήρες” successmessage=”Το αρχείο%filename% υποβλήθηκε επιτυχώς.” warningmessage=”Το αρχείο %filename% υποβλήθηκε επιτυχώς αλλά με κάποιες ειδοποιήσεις.” errormessage=”Το αρχείο %filename% δεν υποβλήθηκε.” waitmessage=”Το αρχείο %filename% βρίσκεται σε κατάσταση υποβολής.” notify=”true” notifyrecipients=”aparask@coresolutions.gr%n%aparask@gmail.com” notifyheaders=”ΥΠΟΒΟΛΗ ΝΕΑΣ ΚΑΛΗΣ ΠΡΑΚΤΙΚΗΣ” notifysubject=”ΥΠΟΒΟΛΗ ΝΕΑΣ ΚΑΛΗΣ ΠΡΑΚΤΙΚΗΣ” notifymessage=”Σας ενημερώνουμε ότι έγινε υποβολή νέας καλής πρακτικής.” attachfile=”true” widths=”title:200, filename:50, selectbutton:20, uploadbutton:20, captcha:30, captchalabel:30, captchatext:30, uploadfolder_label:30, subfolders_label:30, subfolders_select:50, filelist:50, progressbar:30, userdata:100, userdata_label:30, userdata_value:100, message:100″ heights=”title:10, filename:10, selectbutton:10, uploadbutton:10, captcha:10, captchalabel:10, captchatext:10, uploadfolder_label:10, subfolders_label:10, subfolders_select:40, filelist:40, progressbar:10, userdata:10, userdata_label:10, userdata_value:10, message:100″ userdata=”true” userdatalabel=”* ΟΝΟΜΑΤΕΠΩΝΥΜΟ ΥΠΟΒΑΛΛΟΝΤΟΣ (υποχρεωτικό)/* e-mail ΥΠΟΒΑΛΛΟΝΤΟΣ (υποχρεωτικό)/* ΔΗΜΟΣ (υποχρεωτικό)/* ΤΙΤΛΟΣ ΚΑΛΗΣ ΠΡΑΚΤΙΚΗΣ (υποχρεωτικό)” medialink=”false”]

    Καμία βοήθεια; Ευχαριστώ προκαταβολικά!
    Αντώνης Παρασκευόπουλος
    aparask@coresolutions.gr

Ask a question

Answered by Iptanus, usually within a working day.

Ask a question

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Scroll to Top