Ask a Question related to Coldfusion Database Access, Design and Development.
-
JonnyClose #1
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"> </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
-
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... -
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... -
<cfupdate> issue
Input form.... <cfform name="mytst" method="post" action="hotels_edit_action.cfm"> <cfoutput><input name="HotelID" type="hidden"... -
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... -
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... -
BKBK #2
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



Reply With Quote

