Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I have Django running a webapp under Apache2, part of that webapp accepts images posted to a url in Django:

http://mysite/upload

I would like to find a way to set apache to not allow files over 1MB to be posted - ideally showing a custom error. I can't find this in the docs, any ideas?

share|improve this question

1 Answer 1

up vote 1 down vote accepted

I believe you should be able to do this with Apache's LimitRequestBody method.

The LimitRequestBody directive allows the user to set a limit on the allowed size of an HTTP request message body within the context in which the directive is given

...

If, for example, you are permitting file upload to a particular location, and wish to limit the size of the uploaded file to 100K, you might use the following directive:

LimitRequestBody 102400
share|improve this answer
    
The problem is that browsers don't play well with LimitRequestBody. I've experienced weird problems when using it. EDIT: I've just found the detailed lecture on this by Graham Dumpleton: mail-archive.com/django-users@googlegroups.com/msg101549.html –  Tomasz Zieliński May 4 '11 at 21:54

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.