I have recently purchased a Java Image Uploader from http://www.javaatwork.com/java-upload-applet/samplecode.html#coldfusion does anyone have any coding that will allow me to save the image name in a MySQL db during or after a sucessful upload. Any help would be great. Thanks in advance.
Just fyi, that sample is not a good example of well written CF code. I am not even sure it works. You would be better off using the livedocs example http://livedocs.adobe.com/coldfusion/8/htmldocs/Tags_f_10.html#3540091 ... or one of these guides. http://www.coldfusionjedi.com/index.cfm/2007/10/12/File-Upload-Guide http://www.coldfusionjedi.com/index...u-aware-of-the-MIMEFile-Upload-Security-Issue But, to answer your question about that specific example, you use <cffile..> to do the upload. CF then populates a structure named #CFFILE# (or the "result" attribute) with details like the fileName, extension, the directory it was saved to etctera. You can view all of file properties, by dumping the #CFFILE# structure just after your upload: <cffile action="upload" ...> <cfdump var="#CFFILE#"> You then use the #CFFILE# structure in combination with <cfquery ..> to extract and store the filename in your database. <cfquery ...> INSERT INTO SomeTable (SavedFileName) VALUES ( <cfqueryparam value="#CFFILE.serverFile#" cfsqltype="cf_sql_varchar"> ) </cfquery> Out of curiosity, why do you need a separate image uploader? ie What does it do that you cannot do with a regular form?
Thanks your prompt reply, I am relatively new to CF and have only been developing for the last year. I basically am looking to create a cfform that allows a user to upload up to 5 images, restricts file uploads to 2gb and stores the filename in the database, once uploaded the form action redirects the user to to a another page. Any example coding instead of using Java to Work would be greatly apprecieted. Gaz.
I am not suggesting you use java. I was asking what features does the applet give you, that a regular cfform upload does not. The links above give a good example of creating an upload form in CF. The concept is not that different for multiple images. What part are you having difficulty with?