Sorry it was a variable I set. <cfset photofile = "Kind of as a work around for the loop. Because I don't know how to put in the cfif statement to check photo1, photo2, photo3, photo4 individually and run the upload if had a file to upload.
-----Original Message----- From: Adrian Lynch [mailto:[EMAIL PROTECTED] Sent: Saturday, October 20, 2007 10:41 AM To: CF-Newbie Subject: RE: Multiple File Upload Where does photofile come from in this line? <cffile action="upload" filefield="#photofile#" destination="\classifieds\classifiedsphotos" nameconflict="makeunique" /> -----Original Message----- From: Jason Hunter [mailto:[EMAIL PROTECTED] Sent: 20 October 2007 17:45 To: CF-Newbie Subject: RE: Multiple File Upload I guess my main problem is that first I should try to limit the number of arguments I am sending to the function. If they are empty fields, not send. Then when it gets to the function, determine if the variable has a file. The problem is with the loop. I am not getting how to evaluate each argument by number to determine if it is not blank. Obviously, I have to set some kind of variable at the start of the loop? But when I do that, <cfset photo = "photo" & #i# />. Does that define and set a value to the variable? Here is the form <cfoutput> <cfparam name="classphotoaction" default="" /> <cfparam name="adid" default="testing" /> <cfif classphotoaction eq "create"> <cfinvoke component="/renocfc/classifiedsphoto" method="createclassifiedsphotos"> <cfinvokeargument name="adid" value="#adid#" /> <cfloop index="i" from="1" to="4"> <cfset photo = "photo" & #i# /> <cfinvokeargument name="#photo#" value="#photo#" /> </cfloop> </cfinvoke> </cfif> <form action="#cgi.script_name#" method="post" enctype="multipart/form-data"> <cfloop index="i" from="1" to="4"> <label for="photo#i#">Photo #i#:</label> <input id="photo#i#" name="photo#i#" type="file" /><br /> </cfloop> <input id="submit" name="submit" type="submit" value="Add Photo(s) >>>" /> <input id="classphotoaction" name="classphotoaction" type="hidden" value="create" /> </form> </cfoutput> Here is the function. <cffunction name="createclassifiedsphotos" access="public" returntype="void"> <cfargument name="adid" type="any" required="yes" /> <cfset var createclassifiedsphotos = "" /> <cfloop index="i" from="1" to="4"> <cffile action="upload" filefield="#photofile#" destination="\classifieds\classifiedsphotos" nameconflict="makeunique" /> <cfset photo = "#file.clientfile#" /> <cfset resize = imagenew("\classifieds\classifiedsphotos\#photo#") /> <cfset imageresize(resize,"250","") /> <cfimage source="#resize#" action="write" destination="\classifieds\classifiedsphotos\#photo#" overwrite="yes"> <cfquery name="createclassifiedsphoto" datasource="rsoclassifieds"> insert into classifieds_photos ( photofile, adid ) values ( '#photo#', '#arguments.adid#' ); </cfquery> </cfloop> <cfreturn /> </cffunction> ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~| ColdFusion is delivering applications solutions at at top companies around the world in government. Find out how and where now http://www.adobe.com/cfusion/showcase/index.cfm?event=finder&productID=1522&loc=en_us Archive: http://www.houseoffusion.com/groups/CF-Newbie/message.cfm/messageid:3114 Subscription: http://www.houseoffusion.com/groups/CF-Newbie/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.15
