Nick,
Thanks for the info. I would agree that is a quick fix. But this particular
site (version of the site) I want to be primarily server side. All functions
of the site should work regardless of java or jscript.
What I am going to end up doing is forget the looping.
Here is the what I came up with. Now I get a different error when I try
this.
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#" />
<cfinvokeargument name="photo1" value="#photo1#" />
<cfinvokeargument name="photo2" value="#photo2#" />
<cfinvokeargument name="photo3" value="#photo3#" />
<cfinvokeargument name="photo4" value="#photo4#" />
</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>
The function.
<cffunction name="createclassifiedsphotos" access="public"
returntype="void">
<cfargument name="adid" type="any" required="yes" />
<cfargument name="photo1" type="any" required="no" />
<cfargument name="photo2" type="any" required="no" />
<cfargument name="photo3" type="any" required="no" />
<cfargument name="photo4" type="any" required="no" />
<cfset var createclassifiedsphotos = "" />
<cfif evaluate(arguments.photo1) neq "">
<cffile action="upload" filefield="arguments.photo1"
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>
</cfif>
.... Repeat for photo2, photo3, photo4
<cfreturn />
</cffunction>
The error I get.
Invalid CFML construct found on line 1 at column 2.
ColdFusion was looking at the following text:
:
The error occurred in \classifiedsphoto.cfc: line 16
14 : <cfargument name="photo4" type="any" required="no" />
15 : <cfset var createclassifiedsphotos = "" />
16 : <cfif evaluate(arguments.photo1) neq "">
17 : <cffile action="upload" filefield="arguments.photo1"
destination="\classifieds\classifiedsphotos" nameconflict="makeunique" />
18 : <cfset photo = "#file.clientfile#" />
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Download the latest ColdFusion 8 utilities including Report Builder,
plug-ins for Eclipse and Dreamweaver updates.
http;//www.adobe.com/cfusion/entitlement/index.cfm?e=labs%5adobecf8%5Fbeta
Archive:
http://www.houseoffusion.com/groups/CF-Newbie/message.cfm/messageid:3115
Subscription: http://www.houseoffusion.com/groups/CF-Newbie/subscribe.cfm
Unsubscribe:
http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.15