On 1/30/06, Amit Upadhyay <[EMAIL PROTECTED]> wrote: > On 1/30/06, Maniac <[EMAIL PROTECTED]> wrote: > > > > Amit Upadhyay wrote: > > > > > It would be good to have a general django wide setting specifying the > > > maximum length allowed for POST data, if underlying server allowed it. > > > > Django just doesn't control these things. Read my answer in this very > > thread, it's http-server and browser that don't let it happen. > > > > Umm.. I have not done any research on this, but if that was the case > projects like http://sean.treadway.info/demo/upload/ and > http://encodable.com/filechucker/ wouldn't have been > possible. May be some webservers do not support it, and maybe there would be > some issues related to terminating connection if file size is larger, but > having this may be good. > > No time for investigating it right now, but existence of those projects > imply its doable, even if its a hack, atleast on some servers. > >
True, but both of those projects use "AJAX", aka JavaScript. Remember, your trying to test the size of a file **before** it is uploaded. That would require doing the check on the client side - which requires **client side code;** namely, JavaScript. I'm not to up on JS myself and don't really know what capabilities it has in determining file size, if any, but I envision a simple script that intercepts the upload submit, checks the actual file size against the specified limit (perhaps in a hidden field or hard coded in script or even via an ajax request (but why?)) and either returns an error message or submits the upload. Of course, you still have those people who will turn JS off to bypass the limit, so you still want the server side code to validate file size and throw away oversized uploads. Perhaps not ideal, but its an inherit limit of http and (usually) for good reason. -- ---- Waylan Limberg [EMAIL PROTECTED]