(Part 1...my reply is too long)

Hey Dave,

The root of our differences here is that we're designing the
application differently - it affects both the upload and the insert,
and the same logic I used in my insert can (and, imho, should) be used
in the upload portion.

On a really low level, your design has a table that looks like this:

tblProductImages
-------------------------
ProductId
ImageFileName1
ImageFileName2
ImageFileName3

If I understand correctly, you'd do this to handle the upload:

<cffile action="upload" formfield="ImageFileName1"...>
<cfset ImageFileName1 = cffile.serverFile>
<!--- do it again --->
<cffile action="upload" formfield="ImageFileName2"...>
<cfset ImageFileName1 = cffile.serverFile>
<!--- do it...again --->
<cffile action="upload" formfield="ImageFileName3"...>
<cfset ImageFileName3 = cffile.serverFile>

And this for your insert:

<cfquery...>
 INSERT INTO tblProductImages (ImageFileName1, ImageFileName2, ImageFileName3)
 VALUES (...)
</cfquery>

And if you needed all image file names:

<cfquery name...>
 SELECT ImageFileName1, ImageFileName2, ImageFileName3
 FROM tblProductImages
 WHERE productId = ....
</cfquery>

What Scott means by this being a "static" design is that the number of
images per product supported by your application is a static value,
unable to be changed without changing code.  Why trap yourself like
this?  One of the reasons relational databases _exist_ is to avoid
situations like this.

(I'll send part 2 with the solution in a moment)

-- 
For Tabs, Trees, and more, use the jComponents:
http://clearsoftware.net/client/jComponents.cfm

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Discover CFTicket - The leading ColdFusion Help Desk and Trouble 
Ticket application

http://www.houseoffusion.com/banners/view.cfm?bannerid=48

Message: http://www.houseoffusion.com/lists.cfm/link=i:4:190184
Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/4
Subscription: http://www.houseoffusion.com/lists.cfm/link=s:4
Unsubscribe: 
http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4
Donations & Support: http://www.houseoffusion.com/tiny.cfm/54

Reply via email to