Ask a Question related to Coldfusion Database Access, Design and Development.

  1. #1

    Default CFUPDATE Issue

    Maybe its becuase iv been trying to figure this out for 6 hours but im stumped.
    and i know its a simple solution..

    I have 2 pages (forms). im done with the first one (which just adds info into
    my access DB) but once adds the info it goes to my second page (form) which
    asks the user to Browse for a file (image) and upload it. and what it is
    suppsed to do is, add the Image FILENAME to the "picture" colum of my DB which
    row was just created via the page before.

    Now i know people are asking themselves "why is this guy making this on two
    pages" and the reason is, my host doesnt support the Rich Form upload feature
    and my first page is a Rich Flash Form so im just using the normal CFFILE on
    the 2nd page.

    heres what my problem is..

    The file gets uploaded to the correct directory, BUT the entry into the DB is
    wrong.. it doesnt simply put the FILENAME in the DB record it puts this long
    full path name which isent even the correct file. Like this
    "C:\CFusionMX7\runtime\servers\coldfusion\SERV ER-INF\temp\wwwroot-tmp\neotmp5997
    4.tmp"

    (P.S. im testing this on my development server)


    See code below:

    <cfif isdefined("form.UpPic")>


    <CFQUERY NAME="UpCar" DATASOURCE="myDSN">
    SELECT picture
    FROM myTable
    WHERE ID = #FORM.ID#
    </CFQUERY>

    <cffile action="upload" filefield="picture" destination="MyPath"
    nameconflict="overwrite">

    <cfset picture_called = "#file.serverfile#">

    <cfupdate datasource="myDSN"
    tablename ="myTable"
    formfields="ID, picture">




    uploaded! <cfoutput>#picture_called#</cfoutput>


    <cfelse>

    <CFQUERY NAME="GetRecordtoUpdate" DATASOURCE="myDSN">
    SELECT *
    FROM CARS
    WHERE ID = #url.ID#
    </CFQUERY>

    <table width="100%" border="0" cellpadding="0" cellspacing="0">
    <!--DWLayoutTable-->
    <tr>
    <td>
    </td>
    </tr>
    <tr>
    <td height="21">&nbsp;</td>
    </tr>
    <tr>
    <td height="149" valign="top">

    <cfoutput><form action="UploadPic_cars.cfm" method="post"
    enctype="multipart/form-data" name="upload_form" id="upload_form">
    </cfoutput>

    <table width="450" border="1" align="center" cellpadding="5"
    cellspacing="0" bgcolor="#FFFFFF">
    <tr bgcolor="#BACAE4">
    <td><cfoutput query="GetRecordtoUpdate">Upload the >
    <b>#exteriorcolor#, #theyear# #make# #model#</b></cfoutput> </td>
    </tr>
    <tr>
    <td align="center"> </td>
    </tr>
    <tr>
    <td align="center">

    <cfoutput query="GetRecordtoUpdate">
    <input type="hidden" name="ID" id="ID" value="#ID#">
    </cfoutput>

    <input type="file" name="picture" id="picture">
    <input name="UpPic" type="submit" class="button" value="Upload the
    picture"> </td>
    </tr>
    </table>
    </form></td>
    </tr>
    </table>





    Any help with this simple problem would be greatly appreciated... thanks,

    JonnyClose Guest

  2. Similar Questions and Discussions

    1. CFUPDATE Query Error **Help**
      Ok, I am at a serious loss and am getting a headache trying to figure out what exactly is wrong with this simple code. I have a form that pulls...
    2. CF 4.5 issue
      The place I work at runs on CF 4.5. We are trying to get it to connect to MySQL. I don't think it is possible but I can't remember why expecially...
    3. <cfupdate> issue
      Input form.... <cfform name="mytst" method="post" action="hotels_edit_action.cfm"> <cfoutput><input name="HotelID" type="hidden"...
    4. non-php issue
      hi everyone, could someone recommend a security mailing list, please? or you may like to answer my question below: i'm currently using...
    5. nav bar issue
      Does anyone know why a nav bar with rollover effects would create borders around each button when clicked? I have a vertical nav bar with six...
  3. #2

    Default Re: CFUPDATE Issue

    For cffile operations Coldfusion usually requires the absolute path to to a
    resource. If you don't supply one, Coldfusion may use the absolute path of its
    own default temp directory. You can display it with
    <cfoutput>#getTempDirectory()#</cfoutput>, and verify that that is indeed the
    directory that Coldfusion used.

    Make sure the value of the destination-attribute in the cfupdate tag, i.e.
    MyPath, is an absolute path starting from C:\.... Also, make sure that that is
    the value you update the database with.




    BKBK Guest

Posting Permissions

  • You may not post new threads
  • You may post replies
  • You may not post attachments
  • You may not edit your posts

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139