WebFaction
Community site: login faq

I have a file upload field in a django web app. The (image)file will be processed on the fly and then returned to the user. It actually never gets saved in the filesystem (or, if so, it is done transparently by django) Checking if it is a valid image file is easily done with PIL, however I would also like to limit the size of the file upload.

Is there any way (on a lower level, for example through apache/httpd.conf) to limit file upload size, even if data is kept in memory?

asked 10 Feb '12, 02:02

markusbarth
1138
accept rate: 0%

edited 10 Feb '12, 02:03


You could try adding the LimitRequestBody directive in your httpd.conf file but I believe that handling it in your form's code might be a better solution. A snippet similar to this one would do.

permanent link

answered 10 Feb '12, 03:52

iliasr ♦♦
2.2k14
accept rate: 35%

I think LimitRequestBody is the way to go. I fear that for checking on webapp level you depend on the file getting uploaded first before you can actually check its size.

(10 Feb '12, 04:12) markusbarth
Your answer
toggle preview

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text](http://url.com/ "title")
  • image?![alt text](/path/img.jpg "title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported

Question tags:

×22
×14
×5
×4

question asked: 10 Feb '12, 02:02

question was seen: 2,820 times

last updated: 10 Feb '12, 04:15

WEBFACTION
REACH US
SUPPORT
AFFILIATE PROGRAM
LEGAL
© COPYRIGHT 2003-2020 SWARMA LIMITED - WEBFACTION IS A SERVICE OF SWARMA LIMITED
REGISTERED IN ENGLAND AND WALES 5729350 - VAT REGISTRATION NUMBER 877397162
5TH FLOOR, THE OLD VINYL FACTORY, HAYES, UB3 1HA, UNITED KINGDOM