Their 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 their is
enough information for CF to calculate how large a file is
(http://www.ietf.org/rfc/rfc1867.txt?number=1867).

Hope this helps,
-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: Phoeun Pha [mailto:[EMAIL PROTECTED]]
Sent: Friday, January 12, 2001 12:11 PM
To: CF-Talk
Subject: ColdFusion File Handling


We got a bunch of file uploading forms.  we want the max file size to be
5mb.  is there a way coldfusion can check the file size without having
the
file being fully uploaded on the computer? please reply soon!

thanx
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
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