I would very much like to use the multi-file uploader on a site I'm working on but I need to also insert a record to the application database connecting the uploaded file with the property it belongs to. Unfortunately I'm struggling to find information that will help me get the page working the way I want it to. I want to use cfselect to allow the admin staff to choose the property's name from the drop-down list and pass on the property name to the action page along with the uploaded files. The problem is that an error is generated because the action file needs to compare the as yet unsubmitted property name with the database property names. Can you suggest how I might go about getting this to work? Here's the code:
<cfquery name="propertylist" datasource="*****">
<!--- Choose Property to Upload Photos for --->
<cfselect name="propertyname" query="propertylist" display="propertyname" queryposition="below"></cfselect><br />
<!--- Choose Photos to Upload --->
<cffileupload url="cffileupload_action_orig.cfm?#urlEncodedFormat(session.urltoken)#&propertyname=#url.propertyname#" extensionfilter=".jpg, .png, .jpeg" maxuploadsize="1" title="Photo Uploader" width="600" addbuttonlabel="Select Photos" clearbuttonlabel="Remove All Photos" deletebuttonlabel="Remove Photo" />
<input type="submit" value="Submit" id="controls">
<cffile action="uploadall" destination="/Applications/MAMP/htdocs/*******/properties/#Form.propertyname#/images" nameConflict="Overwrite">
<cfquery name="lookupID" datasource="*****">
WHERE propertyname = "#Form.propertyname#"
<cfquery name="addfilename" dataSource="*****">
INSERT INTO images(imagefilename, propID)
VALUES('#CFFILE.SERVERFILE#', '<cfoutput query="lookupID">#propID#</cfoutput>')
I'm hoping someone may know how this could be done?