I'am haveing trouble with this bit of code
what its doin is uploading the image and inserting a link into the database,
I can upload and insert a link but its not the path of image on the server,
but the upload path of the server
Can any one see where i am going wrong.
I have tried the various cffile tags and still no joy
<cffile action = "upload"
fileField = "Image"
Destination="C:\CFusionMX7\wwwroot\example\user images\"
nameConflict = "MakeUnique"
Accept="image/*">
<cfoutput>
You uploaded #cffile.ClientFileName#.#cffile.ClientFileExt#
successfully to #cffile.ServerDirectory#.
</cfoutput>
<cfinsert datasource="userregistration" dbtype="ODBC" tablename="reguser" formfields="FirstName, LastName, UserName, Email, Password, PhoneNumber, VehicleMake, VehicleName, YearOfRegistration, EngineSize, EngineType, Tax, Test, Price, Image">
oh by the way this is the action page!!
Cheers
upload and insert haa!help
Page 1 of 1
3 Replies - 2952 Views - Last Post: 05 January 2007 - 08:54 AM
Replies To: upload and insert haa!
#2
Re: upload and insert haa!
Posted 22 January 2006 - 11:24 PM
You need to change over to cffile.serverfile and it will all work for yor. See sample below.
<cfif form.MYIMAGE gt "">
<cffile action = "upload"
fileField = "MYIMAGE"
Destination="c:\inetpub\wwwroot\railbuffs\assets\"
nameConflict = "MakeUnique"
Accept="image/*">
<cfset MYIMAGE = cffile.serverfile>
</cfif>
you might also want to drop the cfinsert and go with an insert query like so.
<cfquery name="addit" datasource="#dsn#">
INSERT INTO table (stringfield1, numericfield1, stringfield2)
VALUES ('string1', 1, 'string2')
</cfquery>
and just in case be sure your not using cfupdate either go with update query insteed
<cfquery name="updateit" datasource="#dsn#">
UPDATE TABLENAME
SET fieldname1 = '#form.fieldname1#',
fieldname2 = '#form.fieldname2#',
fieldname3 = '#form.fieldname3#'
WHERE somefieldname = 'something'
</cfquery>
This post has been edited by wiredwizard: 02 February 2007 - 08:10 AM
#3
Re: upload and insert haa!
Posted 05 January 2007 - 01:17 AM
My apologies.
This post has been edited by timmaayyb: 05 January 2007 - 12:38 PM
#4
Re: upload and insert haa!
Posted 05 January 2007 - 08:54 AM
You must use [code ][ /code] tags around your code segments, otherwise the posts become excessively long like this one.
It is posted both in the rules and in the add reply box, please use them from now on.
It is posted both in the rules and in the add reply box, please use them from now on.
Page 1 of 1
|
|

New Topic/Question
Reply



MultiQuote




|