Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

CFFILE and #File.ServerFile# - Uploading a 2 different images.

Status
Not open for further replies.

jasonkeller

Programmer
May 23, 2001
16
US
Below is code that populates my Access Database. I need to some how modify this to upload 2 or more images from the same form. It works with the one image valued at "mainpicture_id." I would like to know how to include a "mainthumbnail_id" as well..


<cftransaction>
<cffile action=&quot;UPLOAD&quot;
filefield=&quot;mainpicture_id&quot;
destination=&quot;d:\mjgrant\web\photos\&quot;
nameconflict=&quot;MAKEUNIQUE&quot;>
<CFQUERY DATASOURCE=&quot;mjgrant&quot;>

INSERT INTO products

(mainpicture_id,product_id,product_name)

VALUES

('#File.ServerFile#','#product_id#','#product_name#')

</CFQUERY>
</cftransaction>
 
Hi Jason,

Just add a second file input box for your thumbnail on your form and the code below should do what you need. This has come up several times before and I have never seen or heard of a way to sumbit more than one file through a file input box.

<cffile action=&quot;UPLOAD&quot;
filefield=&quot;mainpicture_id&quot;
destination=&quot;d:\mjgrant\web\photos\&quot;
nameconflict=&quot;MAKEUNIQUE&quot;>

<!--- Store the name of the first file --->
<cfset file1=cffile.serverFile>

<cffile action=&quot;UPLOAD&quot;
filefield=&quot;thumbnail_id&quot;
destination=&quot;d:\mjgrant\web\photos\&quot;
nameconflict=&quot;MAKEUNIQUE&quot;>


<CFQUERY DATASOURCE=&quot;mjgrant&quot;>
INSERT INTO products
(mainpicture_id,product_id,product_name,thumbnail)
VALUES
('#file1#','#product_id#','#product_name#','#CFFile.ServerFile#')
</cfquery>

Hope this helps,
GJ
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top