School Assignment? Project Due Tomorrow? Chat LIVE With A Programming Expert!

Welcome to Dream.In.Code
Become an Expert!

Join 300,406 Programmers for FREE! Get instant access to thousands of experts, tutorials, code snippets, and more! There are 1,598 people online right now. Registration is fast and FREE... Join Now!




Enter file name in MS Access after image update

 

Enter file name in MS Access after image update

coldiron

15 May, 2009 - 01:38 PM
Post #1

New D.I.C Head
*

Joined: 28 Mar, 2007
Posts: 7


My Contributions
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>


User is offlineProfile CardPM
+Quote Post


cfdvlpr

RE: Enter File Name In MS Access After Image Update

23 May, 2009 - 09:49 AM
Post #2

New D.I.C Head
*

Joined: 9 May, 2007
Posts: 5


My Contributions
Remove result="listingimage1" . Or, use listingimage1 in place of file.serverfile . That result variable is optional and it can be used to store the filename in place of file.serverfile.
User is offlineProfile CardPM
+Quote Post

coldiron

RE: Enter File Name In MS Access After Image Update

2 Jun, 2009 - 04:35 PM
Post #3

New D.I.C Head
*

Joined: 28 Mar, 2007
Posts: 7


My Contributions
Thanks for the help. When I saved the information in a hidden text input I was able to use the variable information the way I wanted
User is offlineProfile CardPM
+Quote Post

Fast ReplyReply to this topicStart new topic

Time is now: 11/7/09 10:43PM

Live Help!

Be Social

Dream.In.Code RSS Feed Dream.In.Code LinkedIn Group Follow Us On Twitter Fan Us On Facebook

Tutorials

Programming

Web Development

Reference Sheets

Code Snippets

DIC Chatroom

Bye Bye Ads

Monthly Drawing

Thumb Drive

Top Contributors

Top 10 Kudos This Month