[thelist] testing for <input type="file"> with CF

Raymond Camden jedimaster at macromedia.com
Thu Jul 19 08:35:43 CDT 2001


You can check len, ie <CFIF Len(Form.Fieldname)>, if, and only if, you are
sure the form has been submitted. (I say that because I normally combine
form display and processing on the same page.)

So, assuming a submit button named DoIt...

<CFIF IsDefined("Form.DoIt")>

	<!--- where fieldname is the name of the form field --->
	<CFIF Len(Form.Fieldname)>
		<CFFILE ....
	</CFIF>

</CFIF>


=======================================================================
Raymond Camden, Principal Spectra Compliance Engineer for Macromedia

Email   : jedimaster at macromedia.com
ICQ UIN : 3679482

"My ally is the Force, and a powerful ally it is." - Yoda

> -----Original Message-----
> From: thelist-admin at lists.evolt.org
> [mailto:thelist-admin at lists.evolt.org]On Behalf Of matthew garrett
> Sent: Thursday, July 19, 2001 9:28 AM
> To: thelist at lists.evolt.org
> Subject: [thelist] testing for <input type="file"> with CF
>
>
> hello all,
> i'm looking for the simplest way to determine whether a <input
> type="file">
> field is actually passing a file.
>
> I've been doing this:
>     <cfif 'i need help *here*' >
>         <cffile action="upload" etc.>
>     </cfif>
> with temporary success. But i need a statement that works for all cases.
>
> should i do this instead:
> <cftry>
>     <cffile action="upload" accept="application/pdf, or whatever" etc.>
>     <cfset isitthere="yes">
>   <cfcatch>
>     <cfset isitthere="no">
>   </cfcatch>
> </cftry>
> since it seems to work.
>
> i would like to do the right thing, if there is a right thing.
>
> thanks,
> mg
>
>
> ---------------------------------------
> For unsubscribe and other options, including
> the Tip Harvester and archive of TheList go to:
> http://lists.evolt.org Workers of the Web, evolt !





More information about the thelist mailing list