This is my form page
<head>
<style type="text/css">
p.normal {font-weight: normal;
font-size: 80%}
p.thick {font-weight: bold}
</style>
</head>
<cfoutput>
<cfset PixNum = 10>
<cfif #attributes.Type# EQ "F" >
<p class="normal">Name of the link</p>
<!--- For new link --->
<input type="text"
name="LinkName"
required="yes">
</cfif>
<input type="hidden"
name="PixNum"
value="#PixNum#">
<input type="hidden"
name="Type"
value="#attributes.Type#">
<!--- For existing link --->
<input type="hidden"
name="ID"
value="#attributes.ID#">
<cfset Path = "Path">
<cfset Desc = "Desc">
<cfloop from="1" to="#variables.PixNum#" index="i">
<cfset FileName = "File" & #i#>
<cfset Desc = "Desc" & #i#>
<p class="normal">Location of the image #i#</p>
<!--- browse button --->
<input type="File"
name="#variables.FileName#"
required="yes">
<!--- Description of each Image --->
<p class="normal">Enter description for the image </p>
<textarea name="#variables.Desc#"
cols="30"
rows="3"
title="Enter description">
</textarea> <br> <br> <hr>
</cfloop>
</cfoutput>========================================================
This is my Action Page
<cfset count = 0>
<cfset PixID = 0>
<cfset Path = "C:\CFusionMX7\
<cfoutput>
<cfloop from="1" to="#attributes.PixNum#" index="i" step="1">
<cfset FileName = "Form.File" & #i#>
<cfset Desc = "Form.Desc" & #i#>
<cfset Desc = evaluate(variables.Desc)>
<cfif evaluate(variables.FileName) NEQ "">
<cffile action="upload"
filefield="#variables.FileName#"
destination="#Path#"
ACCEPT="image/jpg, image/pjpeg,image/gif, application/msword, image/bmp, image/tiff"
nameconflict="OVERWRITE">
<!--- Store name of the uploaded file --->
<cfset Count = Count + 1>
<cfset ImageName = #Trim(file.serverfile)#>
<cfset Ext = #Mid(ImageName, Len(ImageName)-2, 3)# >
<cfset ParentID = #Trim(Form.ID)#>
<!--- Insert a link/item into TreeTable, only do it once--->
<cfif #Form.Type# EQ "F">
<!--- At the Folder level, need create a new link in TreeTable --->
<cfset Link = #Trim(Form.LinkName)#>
<cfif Count EQ 1>
<cfquery name="InsertLink" datasource="TreeDS">
Insert into TreeTable
values ('#Link#','L',#ParentID#)
</cfquery>
</cfif>
<!--- Find the auto generated ItemID after inserting link from the above query --->
<cfquery name="FindLinkID" datasource="TreeDS">
SELECT ItemID
FROM TreeTable
WHERE ItemName = '#Link#' AND
ParentID = #ParentID#
</cfquery>
<cfset LinkIDCol = #FindLinkID.ItemID#>
<cfelseif #Form.Type# EQ "L">
<!--- At the Link level, no need to create new link, use existing link to add images --->
<cfset LinkIDCol = #Form.ID#>
</cfif>
<!--- Insert Image to ContentTable --->
<cfquery name="InsertImage" datasource="TreeDS">
Insert into ContentTable
values ('#Ext#', #LinkIDCol#, '#Desc#')
</cfquery>
<!--- Rename images after the ImageID --->
<cfquery name="FindImageID" datasource="TreeDS">
Select ID
From ContentTable
Where LinkID= #LinkIDCol#
</cfquery>
<cfset ImageID = #FindImageID.ID# + #PixID#>
<cfset Src = #Path# & #ImageName#>
<cfset Dest = #Path# & #ImageID# & "." & #Ext#>
<cffile action = "rename"
source = "#Src#"
destination = "#Dest#"
attributes="normal">
<cfset PixID = PixID + 1>
#ImageName# has been uploaded. <br>
<cfelse>
Image #i# has NOT been uploaded due to missing image location<br>
</cfif>
</cfloop>
</cfoutput>