<cfif #file.filewassaved# eq "yes">
can be rewritten to
<cfif file.filewassaved eq "yes">
[or even <cfif file.filewassaved> !]
likewise
<cfset bigpic = '#trim(file.serverfile)#'>
becomes
<cfset bigpic = trim(file.serverfile)>
You need to lock the reference to an Application variable:
DATASOURCE= "#application.dsn#">
or use Request.dsn instead.
Otherwise...
"Paul Swingewood"
<[EMAIL PROTECTED] To: [EMAIL PROTECTED]
tmail.com> cc:
Subject: [ cf-dev ] Comments!
03/08/2004 14:24
Please respond to
dev
Ok I think I have cracked this next phase for the backend of my shoes
application.
I would appreciate any comments on this code. Is this the right way to do
it
etc .....
Just to let you know this is the modify action page which modifies items
.....
Regards - Paul
<cfparam name="PicError" default=0>
<cffile action ="UPLOAD"
filefield ="modifiedsmallpic"
nameconflict = "overwrite"
accept = "image/jpg, image/pjpeg"
destination = "c:/inetpub/wwwroot/store/images/products">
<cfif #file.filewassaved# eq "yes">
<cfset smallpic = '#trim(file.serverfile)#'>
<cffile action ="UPLOAD"
filefield ="modifiedbigpic"
nameconflict = "overwrite"
accept = "image/jpg, image/pjpeg"
destination
= "c:/inetpub/wwwroot/store/images/products">
<cfif #file.filewassaved# eq "yes">
<cfset bigpic = '#trim(file.serverfile)#'>
<CFQUERY NAME= "update_query" DATASOURCE= "
#application.dsn#">
UPDATE tblitems
SET FKmfgID =
#trim(form.modifiedManufacturer)#,
partNum = '#trim(form.modifiedPartNumber)#',
FKcategoryID = #trim(form.modifiedCategory)
#,
subcatID = #trim(form.modifiedSubCategory)#,
ItemName = '#trim(form.modifiedItemName)#',
ItemDescription = '
#trim(form.modifiedItemDescription)#',
ItemCost = #trim(form.modifiedSellingPrice)
#,
teaser = '#trim(form.modifiedTeaser)#',
ItemImage = '#trim(smallpic)#',
ItemBigImage = '#trim(bigpic)#'
WHERE ItemID = #Form.ItemID#
</CFQUERY>
<!--- Now delete the sizes in the itemsizes table
where the itemid match
This ensures that any old data is
removed where an item is in size 1,2,3
and
the user modifies
it to 1,2 (3 must be removed). In this case its easier
to remove
all the sizes and then reinsert the new ones (watch those foreign
keys)--->
<cfquery name="DeleteSizes" datasource="
#application.DSN#">
DELETE FROM tblItemSizes
WHERE FKItemID = #form.itemID#
</cfquery>
<!--- Loop over the sizes inserting the size and the
ItemID --->
<cfloop index = "ListElement"
list = "#form.modifiedsize#">
<cfquery name="addtoitemsizes" datasource="
#application.DSN#">
INSERT INTO tblItemSizes
(FKItemID,
FKSizeID)
VALUES
('#trim(form.ItemID)#',
'#trim(ListElement)#')
</cfquery>
</cfloop>
<cfelse>
<cfset PicError=1>
</cfif>
<cfelse>
<cfset PicError=2>
</cfif>
--
These lists are syncronised with the CFDeveloper forum at
http://forum.cfdeveloper.co.uk/
Archive: http://www.mail-archive.com/dev%40lists.cfdeveloper.co.uk/
CFDeveloper Sponsors and contributors:-
*Hosting and support provided by CFMXhosting.co.uk* :: *ActivePDF provided
by activepdf.com*
*Forums provided by fusetalk.com* :: *ProWorkFlow provided by
proworkflow.com*
*Tutorials provided by helmguru.com* :: *Lists hosted by
gradwell.com*
To unsubscribe, e-mail: [EMAIL PROTECTED]
--
These lists are syncronised with the CFDeveloper forum at
http://forum.cfdeveloper.co.uk/
Archive: http://www.mail-archive.com/dev%40lists.cfdeveloper.co.uk/
CFDeveloper Sponsors and contributors:-
*Hosting and support provided by CFMXhosting.co.uk* :: *ActivePDF provided by
activepdf.com*
*Forums provided by fusetalk.com* :: *ProWorkFlow provided by proworkflow.com*
*Tutorials provided by helmguru.com* :: *Lists hosted by gradwell.com*
To unsubscribe, e-mail: [EMAIL PROTECTED]