Ticket #7638: upload_handling.txt.diff

File upload_handling.txt.diff, 661 bytes (added by Horst Gutmann <zerok@…>, 16 years ago)
  • docs/upload_handling.txt

    diff --git a/docs/upload_handling.txt b/docs/upload_handling.txt
    index 34cd085..30a71e7 100644
    a b objects; see `UploadedFile objects`_ for a complete reference.  
    9191Putting it all together, here's a common way you might handle an uploaded file::
    9292   
    9393    def handle_uploaded_file(f):
    94         destination = open('some/file/name.txt', 'wb')
    95         for chunk in f.chunks():
     94        destination = open('some/file/name.txt', 'wb+')
     95        for chunk in f.chunk():
    9696            destination.write(chunk)
    9797
    9898Looping over ``UploadedFile.chunks()`` instead of using ``read()`` ensures that
Back to Top