Feed Sign in with OpenID OpenID

Simon Willison’s Weblog

Django File Uploads (via) Nearly two years in the making, Django’s file upload capacity has received a major (and backwards incompatible) upgrade. Previously, files were uploaded by default in to RAM—now, files larger than 2.5MB are streamed to a temporary file and extensive hooks are provided to customise where they end up—streaming to S3, for example.

Tagged , , ,

8 comments

  1. Why do people so often jump straight to streaming to S3? ;)

    This is definitely great news, but I suppose it also means I have some work ahead of me now, getting my file storage patch updated to play nice with file uploads.

    Maybe we'll see another significant file-related commit this month! *crosses fingers*

    Marty Alchin - 1st July 2008 18:07 - #

  2. Because it's buzzword-tastic :) It's also a pretty safe bet that any startup dealing with large file uploads is probably storing them on S3 these days, the economics just make a ton of sense.

    Simon Willison - 1st July 2008 18:37 - #

  3. May trac rest in peace :)

    David Cramer - 1st July 2008 19:19 - #

  4. This is great news, in my eyes the limitations of file uploads was the only real weak part of Django forms. I'll definitely start looking at more upload-related stuff now.

    Andrew Ingram - 1st July 2008 22:09 - #

  5. Hey Simon,
    do you know of an implementation example of the direct-to-s3 ability?

    anonymous - 1st July 2008 23:08 - #

  6. I'd be careful using a direct-to-S3 approach, what happens if S3 is down? It will also take longer than a normal upload, better to save it locally and than move it to S3 not as a part of the request-response process IMO.

    Alex - 2nd July 2008 00:05 - #

  7. I never understood why Django implemented its own file upload handling, when the Python cgi module has been using tempfiles for, like, forever. Of all the NIH things in Django it was one of the more baffling.

    I suppose this new code has features the cgi module does not, if it allows streaming to S3. Though creating an intermediate temporary file when moving the file to another server doesn't seem like such a big deal either.

    Ian Bicking - 2nd July 2008 01:15 - #

  8. This is great news.

    Chunking files to disk to avoid overloading RAM was one of the most hacktastic things I've done in ages.

    Richard - 2nd July 2008 01:16 - #

Sign in with OpenID

Auto-HTML: Line breaks are preserved; URLs will be converted in to links.

Manual XHTML: Enter your own, valid XHTML. Allowed tags are a, p, blockquote, ul, ol, li, dl, dt, dd, em, strong, dfn, code, q, samp, kbd, var, cite, abbr, acronym, sub, sup, br, pre

A django site