Corrupt form data: premature ending

后端 未结 5 2023
清酒与你
清酒与你 2020-12-10 10:14

I am trying to upload files using the FileReference class. Files >2MB all work correctly but files <2MB cause this error:

\"java.io.IOException: Co

5条回答
  •  独厮守ぢ
    2020-12-10 10:52

    http://www.servlets.com/cos/faq.html

    Why when using com.oreilly.servlet.MultipartRequest or MultipartParser do large uploads fail? The classes themselves were specifically designed to have no maximum upload size limit (unlike most other file upload utilities), but for your server's protection the constructor allows you to set a maximum POST size to accept. Any upload larger than the limit is halted. The default maximum is 1 Meg. For a discussion of the difficulties a server has in notifying a client of the error, see the discussion in Java Servlet Programming, 2nd Edition, page 119.

    So, did you specify the maximum POST size to accept?

    P.S. Ok, now I see that it's small uploads that cause the problem. On the FAQ link above there is a section dedicated to troubleshooting uploads, including some helful methods to isolate the cause (client, browser, web-server, libraries). Try them.

    Install a Firefox plugin (Tamper Data or Firebug) that shows the request sent to server. May help you to understand if anything is different between <2M and >2M uploads.

    P.P.S. Are the files of the same structure? Could it be that smaller ones have different data (e.g. special symbols) that break Flash library? Try to upload small files of spaces only, for instance.

提交回复
热议问题