Error on form submission containing file input

Posted on 2006-04-06
Last Modified: 2013-12-24
The error "Corrupt form data: premature ending" appears in the cfserver.log when a form is submitted with a file (to be uploaded to the server) from a form using ENCTYPE="multipart/form-data" and the error occurs while using https and ONLY in IE.  Firefox, Safari, etc. are not experiencing the problem.  The user experiences either an immediate "500 Internal Server Error" response or a long lag before receiving the 500 error.

I've seen numerous posts about this issue in the Macromedia forums (via Google groups), but little on the cause or the solution.  There was one very informative post about changing some IIS settings, but we are running Red Hat Linux and ColdFusion MX 7 (with up to date hotfixes).  Perhaps someone out there has run into this problem or has a resource they can point me to.

 Thanks in advance.

 - Louis
Question by:instagrat
    LVL 10

    Expert Comment


    not really a solution but........suggest that your users use a stable browser, as in not IE
    LVL 7

    Expert Comment

    IE is every bit as stable as any other browser, moreso in some cases.

    It would seem, from my experience, to be an issue with high ascii data in other fields in a form that's set to multipart/form-data.
    LVL 9

    Accepted Solution

    I agree with Jeff and completely disagree with Rob.  Not only is it not a solution to tell your users not to use IE - good or bad you simply can't tell ~85% of your potential market that their doing something wrong in order to access your site (Source:!  You have to find a solution, which in this case is very difficult.

    The problem is fairly well known issue with JRun (which of course affects CF7 since it's a JRun application) and even a few of the other J2EE variants.  Jeff is correct in that it's usually due to special characters outside normal ASCII ranges.  Is it possible to transform the field that's containing these characters to something else?  At a guess, unless you only have one or two special chars which are known this could be problematic (if they are always the same you could use a pre-submission validation routine to substitute a character or series of characters to indicate replacements and then reverse the conversion once the data has reached the server.

    A better (although hugely in-elegant solution) might be to split your form that does the upload into two parts - like a wizard.  Form_1 would contain all the form fields with the exception of the file for upload and could then submit with a enctype of "application/x-www-form-urlencoded" which should eliminate the error on the ASCII, and then on the action page which processes that form submission, place your file input and have the upload go by itself as a enctype "multipart/form-data" which should also work correctly.

    To make it at least as good a work-around as possible you could use a script to determine what browser the user is currently using to view/submit the form and only switch to the 2-part process if they are using IE.  That way everything works for everyone, but only the IE people have to go through the 2-step process.

    Sorry I can't be of more help, but far smarter people than I have run up against this problem, and (to my knowledge at least) haven't found a good solution yet.
    LVL 10

    Expert Comment

    kidding..... jeez
    LVL 7

    Expert Comment

    I have a behavior, which is IE-only, that "cleanses" form field data by converting high-ascii characters to their html character entities.  That seems to eliminate the problem.  It does require the scripting is enabled, so a small percentage will still experience a problem.  Due to work restrictions, I'm not permitted to post the code for free, unfortunately,

    Featured Post

    How your wiki can always stay up-to-date

    Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
    - Increase transparency
    - Onboard new hires faster
    - Access from mobile/offline

    Join & Write a Comment

    Suggested Solutions

    In our day to day coding, how many times have we come across a necessity to check whether a URL is a broken link or not? For those of you that answered countless and are using ColdFusion like myself, then this article is for you.  It will show yo…
    Meet the world's only “Transparent Cloud™” from Superb Internet Corporation. Now, you can experience firsthand a cloud platform that consistently outperforms Amazon Web Services (AWS), IBM’s Softlayer, and Microsoft’s Azure when it comes to CPU and …
    Internet Business Fax to Email Made Easy - With eFax Corporate (, you'll receive a dedicated online fax number, which is used the same way as a typical analog fax number. You'll receive secure faxes in your email, fr…
    Here's a very brief overview of the methods PRTG Network Monitor ( offers for monitoring bandwidth, to help you decide which methods you´d like to investigate in more detail.  The methods are covered in more detail in o…

    728 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

    Need Help in Real-Time?

    Connect with top rated Experts

    20 Experts available now in Live!

    Get 1:1 Help Now