Upload a File using CFFILE

Posted on 2000-04-18
Last Modified: 2013-12-24
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">

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.

Abram Weas
Schlumberger Acquisitions Systems Intern

Question by:RobotMan
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 4

Expert Comment

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

That's where the FORM variable containing the uploaded file is 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..

Accepted Solution

nathans earned 30 total points
ID: 2728844
Here is a way to do it...
you need two files.
File 1


<form action="uploadfile.cfm" enctype="multipart/form-data" method="post">
File to Upload: <input name="FileName" size="50" type="file"><br>
<input type="submit" value="Upload the File"


<!-- This File was created by Nathan Stanford 1999 -->
File 2

      <title>File 2</title>

 action="upload" nameconflict="overwrite" filefield="FileName">
File Uploaded!<br><br>

<br><br>Upload More?<br>
<form action="uploadfile.cfm"  enctype="multipart/form-data" method="post">
File to Upload: <input name="FileName" size="50" type="file"><br>
<input type="submit" value="Upload the File"


Author Comment

ID: 2728954
I am going to try the example.  Thanx for the help guys.
Get 15 Days FREE Full-Featured Trial

Benefit from a mission critical IT monitoring with Monitis Premium or get it FREE for your entry level monitoring needs.
-Over 200,000 users
-More than 300,000 websites monitored
-Used in 197 countries
-Recommended by 98% of users


Author Comment

ID: 2732337
Adjusted points from 15 to 30

Author Comment

ID: 2732338
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.

Author Comment

ID: 2732342
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.

Featured Post

ATEN's HDBaseT Presentation at InfoComm 2017

Hear ATEN Product Manager YT Liang review HDBaseT technology, highlighting ATEN’s latest solutions as they relate to real-world applications during her presentation at the HDBaseT booth at InfoComm 2017.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Article by: kevp75
Hey folks, 'bout time for me to come around with a little tip. Thanks to IIS 7.5 Extensions and Microsoft (well... really Windows 8, and IIS 8 I guess...), we can now prime our Application Pools, when IIS starts. Now, though it would be nice t…
What You Need to Know when Searching for a Webhost Provider
This is my first video review of Microsoft Bookings, I will be doing a part two with a bit more information, but wanted to get this out to you folks.
Sometimes it takes a new vantage point, apart from our everyday security practices, to truly see our Active Directory (AD) vulnerabilities. We get used to implementing the same techniques and checking the same areas for a breach. This pattern can re…

635 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question