Dave,
I think I agree with you for small files. I suspect that on small files
the incoming buffer is large enough to deal with the request as a single
chunk.
Although I've never run any hard tests I remember using this solution a
while back and trying upload some huge files and it seemed to do the
trick. If you are talking about large files the buffers are going to be
flushed at least once. The first time they are flushed the HTTP headers
are going to be passed to CF ....then you have the option to kill the
processing.
I suspect a I should do some deeper study into exactly how this is all
happening ;-)
-eric
------------------------------------------------
Common sense is genius dressed in its working clothes.
-- Ralph Waldo Emerson
Eric Barr
Zeff Design
(p) 212.714.6390
(f) 212.580.7181
-----Original Message-----
From: Dave Watts [mailto:[EMAIL PROTECTED]]
Sent: Sunday, February 18, 2001 2:54 PM
To: CF-Talk
Subject: RE: ColdFusion File Handling
> 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