Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

Invalid content type

Explorer ,
May 01, 2007 May 01, 2007
I have a form that allows the user to upload a photo.
It works fine.
However, the CF logs are showing repeated errors on the processing page, like so:

Invalid content type: ""application/x-www-form-urlencoded"".<br>CFFILE action=""upload"" requires forms to use enctype=""multipart/form-data""

I added a try/catch around the cffile tag to try and generate more information about the browser, submitting page, etc., but have yet to determine why this error is being generated.

Does anyone know of a browser that would modify the enctype attribute?
Could someone be attempting to upload a file NOT of type JPG, so that when the cffile tag runs it geneates this error?

Any insight would be greatly appreciated.
Thanks,
bh
6.6K
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Engaged ,
May 01, 2007 May 01, 2007
Are using enctype="multipart/form-data" in your form tag. See http://livedocs.adobe.com/coldfusion/7/htmldocs/00001616.htm.

Ted Zimmerman
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
May 01, 2007 May 01, 2007
Thanks for the reply, but those are basic file upload instructions.
My form works fine 99% of the time.
I'm trying to determine why the content type error is being generated "randomly."
Hoping for some insight regarding the possible manipulation of the encoding of the data, either by a browser or by CF due to some bug or specific file type.
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Mar 12, 2009 Mar 12, 2009
I"m having a similar issue with cffile when I attempt to upload an image. I get the following error in my application log...

Invalid content type: application/x-www-form-urlencoded.The cffile action=""upload"" requires forms to use enctype=""multipart/form-data"".

I originally used a CFFORM tag but changed it to see if error would go away. My form tag is...

<form action="kbUploadResizeResults.cfm" method="post" enctype="multipart/form-data" name="detailEdit">

I also moved from an MX 7 server to an MX 8 server... still get the error.
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Mar 13, 2009 Mar 13, 2009
LATEST
Took me two years to find the culprit...

The form I created to select the image file was OK. I passed the correct parameters to the processing template. The template did an upload and image resize, then presented the results (in text) and a "CLOSE" button - THIS WAS THE CULPRIT! The button was wrapped in its own form with action="" and a JavaScript OnClick="window.close()". Apparently with a blank action, the current template is re-processed and since it was not fed by a form with the proper type for the cffile tag, it created the error.

Solution: wrap the processing code in a <CFIF IsDefined("bottonSubmit"> tag. Now when the Close Window button is pressed, the processing code does not execute.
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Resources