Todd O'Bryan wrote:
> Would it be better to expose the file-like object that comes with a  
> file upload, rather than reading the file's whole content into memory  
> (or into the server's file system, if the patch gets checked in)?  
> It's easy to retain backward compatibility by just having a call to  
> FILES['file_upload']['content'] simply call FILES['file_upload'] 
> ['file_like_object'].read(), but a developer could, instead, decide  
> how large a file they're willing to allow someone to upload, upload  
> that many bytes, and then raise an exception if the file is bigger,  
> rather than waiting until the whole file is uploaded.

This is not really possible. An input stream contains MIMEd data that 
can contain many files. So to have a _full_ request.FILES you have to 
read it entirely.

In fact you don't want to cancel an upload looking at _files_, you want 
to look at the size of a raw stream. This idea is covered (nicely, I 
believe :-) ) in my proposal in that ticket: 
http://code.djangoproject.com/ticket/2070#change_34

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Django developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-developers
-~----------~----~----~----~------~----~------~--~---

Reply via email to