I get the file uploaded to the name that I want, but I keep getting "Element SERVERFILE is undefined in FILE" error when I try to test my variable information stored in file.serverfile. I have commented out most of my database entry code because I wanted to test the file.serverfile information first. I suspect I am missing something elementary but I cant find it.
CODE
<cfset Session.mm_listing_id=1520>
<cfif IsDefined('FORM.upload_button')>
<cfquery name="rsGetListing" datasource="#Request.DSN#">
Select listingid, listingimage1
FROM listings
WHERE listingID = <cfqueryparam value="#SESSION.mm_listing_id#" cfsqltype="cf_sql_clob">
</cfquery>
<!--- <cfquery datasource="#Request.DSN#">
UPDATE listings
SET listingimage1 = '#FORM.upload_file#'
WHERE listingID = <cfqueryparam value="#SESSION.mm_listing_id#" cfsqltype="cf_sql_clob">
</cfquery>--->
<cfif FORM["upload_file"] NEQ "">
<cffile action="upload" destination="#ExpandPath('/images/homes/' & 'listingimage1' & '#SESSION.mm_listing_id#' & '.jpg')#" filefield="FORM.upload_file" nameconflict="overwrite" result="listingimage1" Accept="image/*">
<cfset image1name = "/images/homes/#file.serverfile#">
<cfoutput><img src="/images/homes/#file.serverfile#"></cfoutput><br />
<cfoutput>#file.ServerFile#</cfoutput>
<!--- <cfquery datasource="#Request.DSN#">
UPDATE listings
SET listingimage1 = image1name
WHERE listingID = <cfqueryparam value="#SESSION.mm_listing_id#" cfsqltype="cf_sql_clob">
</cfquery>--->
<!--- <cffile action="upload" nameconflict="overwrite" destination="#ExpandPath('../store/' & product_id & '.jpg')#" filefield="FORM.image_#product_id#" />--->
The File has been uploaded correctly <br /><br />
<cfelse>
No File has been uploaded
</cfif>
<cfoutput>#rsGetListing.listingid#</cfoutput><br /><br />
<cfoutput>#rsGetListing.listingimage1#</cfoutput>
<cfelse>
<form action="<cfoutput>#CGI.SCRIPT_NAME#</cfoutput>" method="post" enctype="multipart/form-data">
<input type="file" name="upload_file" />
<br />
<input type="submit" name="upload_button" value="Upload" />
</form>
</cfif>