• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 629
  • Last Modified:

cffile upload not working

I have simple cffile upload that is not working below is the code:
The file is saved a test server where I work on and not my local drive. When I submit this the browser simply gives me blank screen. I checked on the destination and there is is none. I checked on the #form.AddManual# and it displayed the name of the file. Now, why is it not uploading. Thanks in Advance.
<cfform name="AddAcc" action="Maintain.cfm?MPT=Acc.cfm" method="post"> 
Attach Manual<cfinput type="File" name="AddManual" size="100" 
<cfinput type="submit" name="AddAcs" value="Add Accessories">
</cfform>
<cffile action="upload" filefield="#form.AddManual#" destination="Z:\TimeWeb\PDF\" nameconflict="OVERWRITE">

Open in new window

0
aentice
Asked:
aentice
  • 4
  • 3
1 Solution
 
Tomarse111Commented:
The code below works fine for me, obviously my #uploadPath# points to my upload dir. You were missing a enctype="multipart/form-data" in the cfform, so that might be it.
<cfif Isdefined("AddManual")>
	<cffile action="upload" filefield="AddManual" destination="#uploadpath#" nameconflict="OVERWRITE">
</cfif>
 
 
 
<cfform name="AddAcc" enctype="multipart/form-data" method="post"> 
	Attach Manual <cfinput type="File" name="AddManual" size="100" >
	<cfinput type="submit" name="AddAcs" value="Add Accessories">
</cfform>

Open in new window

0
 
Tomarse111Commented:
Also your filefield="AddManual" doesn't need hashes in it.
0
 
aenticeAuthor Commented:
It doesn't work for me. This is what I did and I created a new page with just this simple code and it gives me an empty page, no error displayed. No file also created on the specified location.
<cfif IsDefined("form.AddManual")>
<cffile action="upload" filefield="AddManual" destination="C:\TimeWeb\PDF\" nameconflict="OVERWRITE">
asdfsadf
</cfif>
<cfform name="AddAcc" enctype="multipart/form-data" method="post" action="MainCont.cfm?MPT=Acc.cfm">
Attach Manual <cfinput type="File" name="AddManual" size="100" >
      <cfinput type="submit" name="AddAcs" value="Add Accessories">
</cfform>
0
Vote for the Most Valuable Expert

It’s time to recognize experts that go above and beyond with helpful solutions and engagement on site. Choose from the top experts in the Hall of Fame or on the right rail of your favorite topic page. Look for the blue “Nominate” button on their profile to vote.

 
aenticeAuthor Commented:
I tested it some more and the error comes from here. When I remove this line then it displays the
 text asadf.
<cffile action="upload" filefield="AddManual" destination="C:\Time\PDF\" nameconflict="OVERWRITE">
0
 
Tomarse111Commented:
what does the action do on the form? If you're submitting to the same page you don't actually need an action on the form ..
0
 
Tomarse111Commented:
Also do you have write permissions on the dir you're trying to write to e,g C:\TimeWeb\PDF\. Have you ever managed to write any files to it from you CF pages?
0
 
aenticeAuthor Commented:
The action does go to same page and I changed all permissions to write.
Extra question: If I'm in my local why would I need to change these permissions?
This code still do not save anything on my drive. And after I submitted file I get a blank screen.
<cfform name="AddAcc" enctype="multipart/form-data" method="post">
      Attach Manual <cfinput type="File" name="AddManual" size="100" >
      <cfinput type="submit" name="AddAcs" value="Add Accessories">
</cfform>
<cfif IsDefined("form.AddManual")>
asdfsadf
<cffile action="upload" filefield="AddManual" destination="C:\LIVE\Time\PDF\">
sdfgdfg
</cfif>
0

Featured Post

[Webinar] Cloud and Mobile-First Strategy

Maybe you’ve fully adopted the cloud since the beginning. Or maybe you started with on-prem resources but are pursuing a “cloud and mobile first” strategy. Getting to that end state has its challenges. Discover how to build out a 100% cloud and mobile IT strategy in this webinar.

  • 4
  • 3
Tackle projects and never again get stuck behind a technical roadblock.
Join Now