Copy link to clipboard
Copied
I'm receiving the below error whenever i attempt to upload a file.
The cffile action="upload" requires forms to use enctype="multipart/form-data".
I'm using <cfform> and have the enctype="Multipart/form-data".
If i do not have a enctype ColdFusion states that the default enctype is incorrect.
I tried using <form> but experienced the same issue.
My <cfform> is in an include and is as follows:
---------------
<cfform enctype="multipart/form-data" name="qb_email" action="OA_util_rpt3.cfm?List=#url.list#&t=#url.t#" method="POST" onsubmit="return FormCheck(this)">
---------------
Anyone have any ideas as to why i'm getting this error when i do in fact have enctype defined. I have this exact same code in several other pages and everywhere else it works fine. However, this is the only one where i go from a folder back to main directory, then to another folder for the include, and then back to main directory and then to batch to upload file.
Another interesting thing is the file is uploaded into my Batch folder but i get the message, and if i go back to the page, the file is listed and will be attached to my email as intended.
Thanks,
Daniel
Copy link to clipboard
Copied
What's happening in the form's onsubmit event handler?
Dave Watts, CTO, Fig Leaf Software
http://www.figleaf.com/
http://training.figleaf.com/
Copy link to clipboard
Copied
I removed the onsubmit and still have the same issue.
What this is doing is sending an email and if i don't attach a file it works fine. It only happens when attaching a file.
Thanks For looking into this...
Daniel
Copy link to clipboard
Copied
Maybe you should post the form and action page(s) in their entirety.
Dave Watts, CTO, Fig Leaf Software
http://www.figleaf.com/
http://training.figleaf.com/
Copy link to clipboard
Copied
Like Dave, I suspect it's got to do with the onSubmit. It seems that the Javascript call changes the enctype to a blank. What if you do something like this
onsubmit="return FormCheck(this); return true;"
Copy link to clipboard
Copied
Rough code for for <cfform> i removed the onsubmit and the issue still exists.
-----------
<cfform enctype="multipart/form-data" name="qb_email" action="OA_util_rpt3.cfm?List=#url.list#&t=#url.t#" method="POST">
I'm attempting to write an email include that will allow me to plug in this email with attachments anywhere i want. I have this exact same code. In about 10 different places and all of them work.
Copy link to clipboard
Copied
Try commenting out the CFTEXTAREA, or setting the RICHTEXT attribute to "no".
Dave Watts, CTO, Fig Leaf Software
http://www.figleaf.com/
http://training.figleaf.com/
Copy link to clipboard
Copied
Also, what exactly are you doing with the two submit buttons? That might be the cause of the problem. You should post your action page logic in full, not just the CFFILE tag, as I suggested earli
Dave Watts, CTO, Fig Leaf Software
http://www.figleaf.com/
http://training.figleaf.com/
Copy link to clipboard
Copied
Tthe 2 submits is for submitting the form for sending the email, and the other submit so submitting the form and attaching the files. This code was written before the uploadall in CF9. So we had to upload 1 file at a time.
The issue is only when i attach a file, and only with the cffile and for some reason enctype is being lost or set to ''. Does anyone know why a form would lose enctype? As i mentioned before, this code is working in about10 other places. So 2 submit buttons or other code i'm sure is not the issue. Is there a way where i can set content type after the forum that <cffile> will interpret?
Thanks for all your help,
Daniel
Copy link to clipboard
Copied
Again, unless you actually post all the code, all anyone can do is guess. Even then, it might be all we can do.
Dave Watts, CTO, Fig Leaf Software
http://www.figleaf.com/
http://training.figleaf.com/
Copy link to clipboard
Copied
Copy link to clipboard
Copied
I thought you would be showing us the form page, not the action page. It would also help to show the stack trace or to indicate the line where the error occurs.