Greetings all, from a noob. I'm trying to figure out how to upload a file and store its name and location into a database for subsequent retrieval. I will append the code below, but I will say this: it uploads pictures, and stores their names into the db. I just don't know how to get CF to get the file location once I've updated and then add that to the DB.
<body> <cfif isdefined ("form.image1")> <cfelse> <form action="trial.example.imageupload.cfm" method="post" enctype="multipart/form-data" name="upload_form" id="upload_form"> <table width="450" border="1" align="center" cellpadding="5" cellspacing="0" bgcolor="#FFFFFF"> <tr> <td>Upload An Image</td> </tr> <tr> <td align="center"> </td> </tr> <tr> <td align="center"><input type="file" name="Image1" id="Image1"> <input name="upload_now" type="submit" class="button" value="Upload the image"></td> </tr> </table> </form> </cfif> <!---the address of the current file---> <cfset currentPath = getCurrentTemplatePath()> <cfif isdefined("form.Image1")> <!--- why is the current path working?---> <cffile action="upload" filefield="Image1" destination="#currentPath#\secure\" nameconflict="overwrite" accept="image/*" > <cfset uploadedfile = "\secure\#file.serverfile#"> <cfset path ="secure/#file.serverfile#" > <br> <br> <p align="center">Click the confirm button to insert into the database</p> <table width="450" border="1" align="center" cellpadding="6" cellspacing="0"> <tr valign="top"> <cfoutput> <form action="trial.example.imageupload.cfm" method="post"> <br> <br> <input type="submit" name="InsertIt" value="Click to confirm"> <input name="Title" type="hidden" value="#file.ServerFile#"> <input name="Location" type="hidden" value="#path#" > </form> </cfoutput> </td> </tr> </table> </cfif> <cfif isdefined ("form.InsertIt")> <p align="center">You inserted the image name <cfoutput>#Form.Title#</cfoutput> in to your database.<br> Upload another image.</p> <cfoutput><input name="Image" type="hidden" value="#form.Title#"></cfoutput> <cfinsert datasource="omfoto" tablename ="pics" formfields="Title,Location" > </cfif> </body> </html> ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~| Want to reach the ColdFusion community with something they want? Let them know on the House of Fusion mailing lists Archive: http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:333210 Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm