pictures into a single archive, then after the upload is complete unzip
the contents, do the database inserts, and post processing? Or would
this be a bad way to go?
Thanks,
John
-----Original Message-----
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]
Sent: Monday, November 24, 2003 3:24 PM
To: CF-Talk
Subject: Re: Advise about how to upload multiple files
you may wanna concider letting them upload say 5 at a time and having 5
table fields for images in your db.
then just add 5 file fields to the form with names like pic1, pic2,
pic3,
pic4, pic5. then on the action page u need the upload file code for each
field but you really need to check each field to make sure it has
something in it first. you can do this with a simple if statement. then
to
you need to set the serverfile to a unique name cause u can only have 1
to
do the db insert
this line is VERY IMPORTANT
<cfset pic1 = #file.serverfile#>
because when u go to do the insert they each need unique names
something like this (of course change to fit your needs)
<!---
Author: .::. ME .::. [EMAIL PROTECTED]
Date Created: 08/12/03
--->
<!--- make sure productID was passed on --->
<cfif NOT isdefined("form.submit")>
<h2>Sorry there has been an error, please try again</h2>
<p><a href="" back</a></p>
<cfabort>
</cfif>
<!--- do the file 1 upload now --->
<cfif #form.pic1# NEQ "">
<cffile Action=""> Filefield="pic1"
DESTINATION="C:\Websites\folder\site\uploads\"
Nameconflict="makeunique" accept="image/*">
<cfset pic1 = #file.serverfile#>
</cfif>
<!--- do the file 2 upload now --->
<cfif #form.pic2# NEQ "">
<cffile Action=""> Filefield="pic2"
DESTINATION="C:\Websites\folder\site\uploads\"
Nameconflict="makeunique" accept="image/*">
<cfset pic2 = #file.serverfile#>
</cfif>
<!--- do the file 3 upload now --->
<cfif #form.pic3# NEQ "">
<cffile Action=""> Filefield="pic3"
DESTINATION="C:\Websites\folder\site\uploads\"
Nameconflict="makeunique" accept="image/*">
<cfset pic3 = #file.serverfile#>
</cfif>
<!--- do the file 4 upload now --->
<cfif #form.pic4# NEQ "">
<cffile Action=""> Filefield="pic4"
DESTINATION="C:\Websites\folder\site\uploads\"
Nameconflict="makeunique" accept="image/*">
<cfset pic4 = #file.serverfile#>
</cfif>
<!--- do the file 5 upload now --->
<cfif #form.pic5# NEQ "">
<cffile Action=""> Filefield="pic5"
DESTINATION="C:\Websites\folder\site\uploads\"
Nameconflict="makeunique" accept="image/*">
<cfset pic5 = #file.serverfile#>
</cfif>
<!--- insert the contents of the form into the db --->
<cfif isdefined ("form.submit")>
<cfquery name="qaddlisting" datasource="#dsn#">
INSERT INTO listings (stock, company, model, price, type, year,
condition, newUsed, color, hitchStyle, construction, axels,
sleeps, hauls, floorLength, tires, emptyWeight, description,
overallEquiptment, stallAreaEquiptment, dressingRoom,
foldingRearTack, pic1, pic2, pic3, pic4, pic5)
VALUES ('#form.stock#', '#form.company#', '#form.model#',
'#form.price#', '#form.type#', '#form.year#', '#form.condition#',
'#form.newUsed#', '#form.color#', '#form.hitchStyle#',
'#form.construction#', '#form.axels#', '#form.sleeps#',
'#form.hauls#', '#form.floorLength#', '#form.tires#',
'#form.emptyWeight#', '#form.description#',
'#form.overallEquiptment#',
'#form.stallAreaEquiptment#', '#form.dressingRoom#',
'#form.foldingRearTack#',
'#pic1#', '#pic2#', '#pic3#', '#pic4#', '#pic5#')
</cfquery>
</cfif>
<!--- send to menu --->
<cflocation url="" addtoken="no">
>
>
> Message: http://www.houseoffusion.com/lists.cfm?link=i:4:144953
> Archives: http://www.houseoffusion.com/lists.cfm?link=t:4
> Subscription: http://www.houseoffusion.com/lists.cfm?link=s:4
> Unsubscribe:
> http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=3248.3032.4
________________________________
[Todays Threads] [This Message] [Subscription] [Fast Unsubscribe] [User Settings]

