Link to home
Start Free TrialLog in
Avatar of mchristopher
mchristopherFlag for United States of America

asked on

ColdFusion error when uploading files: The files upload action requires forms to use enctype="multipart/form-data".

The following code fails and shows the error output in the title. What the heck is going on? Thanks for considering this.

               <form method="post" enctype="multipart/form-data">
                        Select a file:
                        <input type="file" name="fileUpload">
                        <input type="submit" value="Upload File">
                  </form>  
                 
                  <cffile action="upload"
                  accept = "application/pdf,application/msword"
                  filefield="fileUpload"
                  destination="e:\wwwroot\cmis\cmisfiles\security\upload\"  
                  result="FileUploadedYes">

                          <cfdump var="#FileUploadedYes#">
Avatar of gdemaria
gdemaria
Flag of United States of America image

I would look at your view-> source on your browser, perhaps you have more than one form and they are nested somehow?  

What you are showing should work, but I suspect it is not your actual code..
ASKER CERTIFIED SOLUTION
Avatar of _agx_
_agx_
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 mchristopher

ASKER

<CFDUMP VAR="#FORM#"> C:\ColdFusion11\cfusion\runtime\work\Catalina\localhost\tmp\neotmp6530038827429928089.tmp
Yet, the file does not exist in that location.
So, I need to dig in some more and provide greater detail. Will do tomorrow. Thanks.
That's just a temporary location where files are stored before cffile upload is executed. To find out where the file was uploaded, dump your cffile result attribute instead. CFFile returns a structure with a bunch of variables, such as serverFile, serverDirectory, etcetera.

<!--- do the upload --->
<cffile action="upload" .... result="FileUploadedYes">
<!--- dump the results --->
<cfdump var="#FileUploadedYes#">
Quick and clear answer. Follow up assistance helped too.
Thank you!