On Sunday 29 January 2006 20:29, arthur debert wrote: > is there a way to check for this BEFORE the file > is uploaded?
On Monday 30 January 2006 08:15, Adrian Holovaty wrote: > On 1/30/06, tonemcd <[EMAIL PROTECTED]> wrote: > > So does this happen *before* the file is uploaded - I mean when the > > submit button is pressed? It seems that Django will be getting > > information from the browser about the length of the data to be > > uploaded - and that's something I've always thought HTTP could not > > do... > > As far as the validator I posted, it does the validation *before* the > file is saved to the filesystem, when it is still in memory. But that is *after* all the file bits have been sent from the browser to the server. Right? My understanding is that the op wants to keep bandwidth under control by refusing to allow files greater than N bytes from ever entering memory. I've not yet found a way to do so; in the past, I've had to examine the size of the uploaded file after it has arrived at the server in its entirety. It works, but the consumed bandwidth was wasted for files that exceeded the size limit as the bits were simply tossed.