I am trying to code an application to capture the name of multiple images that
are being upload at once. I have created session variables to hold the values,
but because I am using a loop to do the process I want to create the set the
session variable to store current information on the fly, but I get an error
that I suspect is generated because of my assignment code (<cfset
SESSION.consumerProductExtraImg.Img & #i# = "#filename#">) in my code below:
<cfset SESSION.consumerProductExtraImg =structNew()>
<!--- collect consumer product details --->
<!---cfset SESSION.consumerProductExtraImg.userID = ""--->
<cfset SESSION.consumerProductExtraImg.Img1 = "">
<cfset SESSION.consumerProductExtraImg.Img2 = "">
<cfset SESSION.consumerProductExtraImg.Img3 = "">
<cfset SESSION.consumerProductExtraImg.Img4 = "">
<cfset SESSION.consumerProductExtraImg.Img5 = "">
<cfset SESSION.consumerProductExtraImg.Img6 = "">
<cfset SESSION.consumerProductExtraImg.Img7 = "">
<cfset SESSION.consumerProductExtraImg.Img8 = "">
</cfif>
<!--- if user submits consumer product details, remember it --->
<!---create variable to hold number of form fields to create--->
<cfset numberoffields = 8>
<cfform action="process_UpLoadExtraConsumerProductImages.cfm"
enctype="multipart/form-data">
<cfloop index="i" from="1" to="#variables.numberoffields#" step="1">
<cfset filename = "#SESSION.consumerProduct.Cnsmr_ProductID#" & #i#>
<cfinput type="File" name="<cfoutput>#variables.filename#</cfoutput>" /><br
/>
<!--- Set the respective file name for the uploaded image --->
<cfset SESSION.consumerProductExtraImg.Img & #i# = "#filename#">
</cfloop>
<cfinput type="Submit" name="upload" value="upload" />
</cfform>
The error generated is:
Invalid CFML construct found on line 45 at column 58.
ColdFusion was looking at the following text:
=
The CFML compiler was processing:
A cfset tag beginning on line 45, column 10.
A cfset tag beginning on line 45, column 10.
A cfset tag beginning on line 45, column 10.
The error occurred in
C:\ColdFusion8\wwwroot\e-Ghana\uploadExtraConsumerProductImages.cfm: line 45
43 : <cfinput type="File" name="<cfoutput>#variables.filename#</cfoutput>"
/><br />
44 : <!--- Set the respective file name for the uploaded image --->
45 : <cfset SESSION.consumerProductExtraImg.Img & #i# = "#filename#">
46 : </cfloop>
47 : <cfinput type="Submit" name="upload" value="upload" />
TIA
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Adobe® ColdFusion® 8 software 8 is the most important and dramatic release to
date
Get the Free Trial
http://ad.doubleclick.net/clk;207172674;29440083;f
Archive:
http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:319676
Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4