Adam Bourg
Adam Bourg

Reputation: 59

Coldfusion: Uploading and inserting into MYSQL database

Here's the problem:

I have form with some user info, I need to attach a picture. I've got everything setup the way it needs to go, but when I process the form, it uploads the file and then inserts this into the database:

> D:\ColdFusion8\runtime\servers\coldfusion\SERVER-INF\temp\wwwroot-tmp\neotmp52353.tmp

Yet the file exists at:

./uploads/imagen1.jpg

This is a piece of my form:

<cfform action="process_person.cfm"  enctype="multipart/form-data"> 
<cfinput type="file" required="no"  name="Photo">

This is the processor, which his the CFC file:

<cfinvoke component="cfc/certifcations" method="add">

<cffile action="upload" filefield="Photo" destination="#destination#" nameConflict="makeUnique" result="upload">
 <cfdump var="#upload#">
<cfinvokeargument name="Photo" value="#Form.Photo#">

This is the CFC piece:

 <cfargument name="photo" type="string" required="no">

I need the ./uploads/imagen1.jpg inserted into the database not the tmp file. Where am I going wrong? THe file is uploading correctly.

Upvotes: 1

Views: 566

Answers (1)

Adam Bourg
Adam Bourg

Reputation: 59

I had result specified to upload.

What I did was remove that, then set #cffile.serverFile# in my value for my cfinvokeargument. That gave me the file name. Now I am working on getting the path. I hope this helps!

Upvotes: 1

Related Questions