Hi.

Is there a way to limit upload file size *before* the upload is
accepted?

Say I want to give people the option of uploading movie files, but I
want to limit them to 4MB per movie. If I understand the upload
behaviour of Django correctly, the file is first accepted into main
memory (*) , after which I have access to metadata.
This would mean that somebody could easily OOM my Apache just by
uploading a huuuuuge file. Also, in a hosted environment, this is
unnecessary traffic which I'd have to pay for.

If there were a way to check the "content-length" header BEFORE
accepting the upload, this problem could be prevented (the socket could
just be closed and a "permission denied" response or some other HTTP
error could be returned).

Is there a way to do this?

Daniel

(*) I'm aware that there are also Django extensions which do this
streaming to disk, instead of to memory; still, I'd have to accept the
sender's bulk data before I could discover that it is way too big.


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Django users" 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-users
-~----------~----~----~----~------~----~------~--~---

Reply via email to