> There is no reason that you can't use the HTTP headers to determine
> size, cgi.content_length will give you a good *approximation* of the
> file size that is being uploaded.  I say approximation because content
> length is the size of all the content on the page, of which you might
> have form fields or other variable length data being posted.
> 
> You could use something like :
> 
> <cfif cgi.content_length GT Application.maxFileSize>
>       <!--- someone is uploading a file bigger than we permit --->
>       <cflocation url="addDocumentError.cfm?error=fileSize">
> </cfif>
> 
> I have to say this is one of the rather disappointing "features" 
> of CF ....if you look at the raw information being sent to the 
> server there is enough information for CF to calculate how large 
> a file is (http://www.ietf.org/rfc/rfc1867.txt?number=1867).

I think the problem here is that, by the time CF could read the
Content-Length HTTP request header, it's too late - the browser has sent the
file within the HTTP request body, and the web server has already received
it.

Before the CF engine receives an HTTP request to process, that request has
already been received in its entirety by the web server. The web server
deals with issues like malformed requests, so it stands to reason that the
file has to be written in full to the web server before CF gets to look at
it.

Dave Watts, CTO, Fig Leaf Software
http://www.figleaf.com/
voice: (202) 797-5496
fax: (202) 797-5444

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Structure your ColdFusion code with Fusebox. Get the official book at 
http://www.fusionauthority.com/bkinfo.cfm

Archives: http://www.mail-archive.com/[email protected]/
Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists

Reply via email to