hi Eric,

thanks for the response. But I was looking from the point of adding
the handler to apache. that way, if an uploaded file is larger than
allowed size, it wont even get posted to the tmp directory and you
wont end up using any bandwidth / memory with the illegal upload.

its working correctly, except invoking the 500.html instead of the
appropriate msg

pranav.

On Jul 16, 2:34 am, Eric Abrahamsen <[EMAIL PROTECTED]> wrote:
> If you wanted to do this purely within django, you could write a  
> custom middleware that reads a 'request body max size' setting from  
> settings.py, then checks the content-length header on incoming request  
> against that setting and returns a custom 413 if it's too large. I  
> believe that doing this in process_request will allow you to catch the  
> content-length header before the message body has been read (but I'd  
> sure like to hear about it if that's not 
> true).http://www.djangoproject.com/documentation/middleware/
>
> I don't know enough about how apache and django interact to tell you  
> how to fix your current solution, sorry...
>
> Eric
>
> On Jul 16, 2008, at 11:18 AM, [EMAIL PROTECTED] wrote:
>
>
>
> > I have used the LimitRequestBody directive in the apache conf to set
> > it to 1 mb. so, any files biggers than 1 mb should be rejected.
>
> > while testing it however, i found that when i try to upload a file
> > larger than 1 mb, it ends up displaying my custom 500.html page..
>
> > how can I display another custom error page ?
>
> > i also tried with this directive in apache conf file:
>
> > ErrorDocument 413http://www.<my-host>/413error/
>
> > and then defined the 413error in urls.py and tried to display a custom
> > template. but no luck.
>
> > any ideas ?
--~--~---------~--~----~------------~-------~--~----~
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?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to