works, so I'm looking for an explanation.
This code uploads a file and if it's too large, it directly the user
to an error page. I know that the file has to be uploaded into
memory before it can check file size but I don't see how the <cfif>
check on the file size afterwards either comments or tosses the file
upload. It does.
<cfif isdefined("Form.NewFile")>
<cftry>
<cfset CurrentDir=GetDirectoryFromPath(ExpandPath("*.*"))>
<cffile
action=""> filefield="NewFile"
destination="/#CurrentDir#/CrsMat/"
accept="application/vnd.ms-powerpoint"
nameconflict="MakeUnique">
<!--- if an unauthorized file type upload is attempted --->
<cfcatch type="Any">
<cflocation url="" addtoken="No">
</cfcatch>
</cftry>
<!--- check the CGI environment variable Content_Length to make sure the file
being uploaded is less than 10 MB in size. If it is not, halt
processing --->
<CFIF Val(CGI.CONTENT_LENGTH) GT 10485760>
<cflocation url=""
addtoken="No">
<CFABORT>
</CFIF>
There's no commit or anything like that after this. It just displays
some of the cgi file-info.
So how does this file size check, which happens after the file upload
into memory, either ok or not-ok the file upload? I just don't get
it.
--
Daniel Kessler
Department of Public and Community Health
University of Maryland
Suite 2387 Valley Drive
College Park, MD 20742-2611
301-405-2545 Phone
www.phi.umd.edu
[Todays Threads] [This Message] [Subscription] [Fast Unsubscribe] [User Settings]