?
Solved

Upload a File using CFFILE

Posted on 2000-04-18
6
Medium Priority
?
242 Views
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">
</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




0
Comment
Question by:RobotMan
[X]
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
6 Comments
 
LVL 2

Expert Comment

by:dlewis9
ID: 2728243
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..
0
 
LVL 5

Accepted Solution

by:
nathans earned 120 total points
ID: 2728844
Here is a way to do it...
you need two files.
=======================
File 1
=======================
<html>
<head>
      <title>File1</title>
</head>

<body>

<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"
</form>


</body>
</html>
   





<!-- This File was created by Nathan Stanford 1999 Email:nathan@cyberservices.com http://www.nsnd.com -->
=======================
File 2
=======================

<html>
<head>
      <title>File 2</title>
</head>

<body>
<cffile
 destination="e:\netscape\server\docs\admin"
 action="upload" nameconflict="overwrite" filefield="FileName">
<cfoutput>
File Uploaded!<br><br>

</cfoutput>
<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"
</form>

</body>
</html>
           
0
 

Author Comment

by:RobotMan
ID: 2728954
I am going to try the example.  Thanx for the help guys.
0
Simplify Your Workload with One Tool

How do you combat today’s intelligent hacker while managing multiple domains and platforms? By simplifying your workload with one tool. With Lunarpages hosting through Plesk Onyx, you can:

Automate SSL generation and installation with two clicks
Experience total server control

 

Author Comment

by:RobotMan
ID: 2732337
Adjusted points from 15 to 30
0
 

Author Comment

by:RobotMan
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.
0
 

Author Comment

by:RobotMan
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.
0

Featured Post

U.S. Department of Agriculture and Acronis Access

With the new era of mobile computing, smartphones and tablets, wireless communications and cloud services, the USDA sought to take advantage of a mobilized workforce and the blurring lines between personal and corporate computing resources.

Question has a verified solution.

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

Have you ever sent email via ColdFusion and thought of tracking this mail to capture the exact date and time when the message was opened ?  If yes, then this article is for you ! First we need a table user_email with columns user_id , email , sub…
Most ColdFusion developers get confused between the CFSet, Duplicate, and Structcopy methods of copying a Structure, especially which one to use when. This Article will explain the differences in the approaches with examples; therefore, after readin…
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.
Visualize your data even better in Access queries. Given a date and a value, this lesson shows how to compare that value with the previous value, calculate the difference, and display a circle if the value is the same, an up triangle if it increased…

719 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