Link to home
Start Free TrialLog in
Avatar of RobotMan
RobotManFlag for United States of America

asked on

Upload a File using CFFILE

I want to be able to upload a file that the user chooses.  This is the code I have used:

<CFFORM action="added.cfm" method="post" name="Archive">
<input type="file" name="path">

<CFFILE action="upload" filefield="path" destination="C:\Inetpub\wwwroot\CFDOCS\Project2\files\" nameconflict="overwrite">

<input type="submit" value="Archive File">
</CFFORM>

All on the same page.  However, I get the error:

Error Occurred While Processing Request
Error Diagnostic Information
The form field specified in the CFILE tag(PTAH) does not contain an uploaded file.  Please be sure that you have specified the correct field name.
The erroro occured while processing an element with a general identifier of (CFFILE), occupying the document position (91:7) ti (91:128).

What am I doing wrong?

PS I am willing to change the point value, it just seems as though this should be a really easy question.

Thanx,
Abram Weas
Schlumberger Acquisitions Systems Intern
aweas@austin.apc.slb.com




Avatar of dlewis9
dlewis9

Your CFFILE needs to be on the action page..(added.cfm)

That's where the FORM variable containing the uploaded file is available..you can't do it all on the same page because the form doesn't get submitted until they press the submit button..

Also, I checked some code that I am using and I have ENCTYPE="multipart/form-data" specified in the CFFORM tag..not sure if that's necessary or not.  I can post an example for you if that doesn't work out..
ASKER CERTIFIED SOLUTION
Avatar of Nathan Stanford Sr
Nathan Stanford Sr
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of RobotMan

ASKER

I am going to try the example.  Thanx for the help guys.
Adjusted points from 15 to 30
Thanx Nathans...
  (One of the smartest people I know is named Nathan -- maybe that is just a theme)
  I got the code to work perfectly.  I may have more questions later concerning this, but you really helped me leap this hurdle.
This was just what I needed...

Thank you for helping me out.
I am new to this points thing -- I hope that you got enough.