Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

On my project, I will allow users to send zip files and images files (on two different form post).

The project is developed with Play! Framework (not PHP).

I'd like to limit the size of upload for 1Mo if it's images, and 10Mo if it's zip.

Is this possible ?

I saw the directive client_max_body_size that should do what I'm looking for, but I can't find a way to apply this per mimetype.

Thanks for your help :)

share|improve this question

You can create different locations whith different client_max_body_size (or everything u want) for images, zips and etc.

just use:

location ~* ^.+\.(jpg|jpeg|gif) {

client_max_body_size 1m;
...proxy_pass or whatever

location ~* ^.+\.(zip|rar) {
client_max_body_size 10m;
...proxy_pass or whatever

share|improve this answer
is location not where the user goes in the website? like ? – Cyril N. Feb 3 '12 at 14:52

Your Answer


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.