As CFML runs on the server, that code will not execute until after the file
has been uploaded.
 
Russ

-----Original Message-----
From: Doug Brown [mailto:[EMAIL PROTECTED] 
Sent: 05 December 2006 15:39
To: CF-Talk
Subject: Re: Any way to limit file upload size?

What about something like so. Am I way off? It checks before the image is
uploaded.


page_1.cfm

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd";>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<title>Untitled Document</title> </head>

<body>
<form action="page_1.cfm" method="post" enctype="multipart/form-data">
<input type="file" name="test1"> <input type="submit" name="submitThis">
</form>


<cfset allowedFileSize = 1000>
<cfif isDefined("form.submitThis")>
<cfoutput>
<cfif cgi.content_length gt "#Val(allowedFileSize)#"> Error your file is
wayyyyy to big<br> </cfif> Your file size was: #cgi.CONTENT_LENGTH# and the
allowed size was #allowedFileSize# </cfoutput> </cfif>

</body>
</html>




Doug





----- Original Message -----
From: "Snake" <[EMAIL PROTECTED]>
To: "CF-Talk" <cf-talk@houseoffusion.com>
Sent: Tuesday, December 05, 2006 7:06 AM
Subject: RE: Any way to limit file upload size?


> There is a setting in IIS to limit the size of form posts. But I can't
find
> it for the life of me.
>
>
> -----Original Message-----
> From: Gaulin, Mark [mailto:[EMAIL PROTECTED]
> Sent: 05 December 2006 13:29
> To: CF-Talk
> Subject: Any way to limit file upload size?
>
> Hi
> Is there any way in CF or IIS to limit the allowed file size for a form
with
> a file "attached"?
>
> I have a situation where someone might accidentally upload a huge file
when
> all we want is a sample file.  I would want to avoid not only creating a
> huge temp file but also all of the bandwidth needed to send the file to
the
> server.
>
> Thanks
> Mark
>
>
>
> 



~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Create robust enterprise, web RIAs.
Upgrade & integrate Adobe Coldfusion MX7 with Flex 2
http://ad.doubleclick.net/clk;56760587;14748456;a?http://www.adobe.com/products/coldfusion/flex2/?sdid=LVNU

Archive: 
http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:262890
Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4

Reply via email to