损坏的表单数据:过早结束 [英] Corrupt form data: premature ending
问题描述
我正在尝试使用 FileReference 类上传文件.大于 2MB 的文件都可以正常工作,但小于 2MB 的文件会导致此错误:
I am trying to upload files using the FileReference class. Files >2MB all work correctly but files <2MB cause this error:
"java.io.IOException: 损坏的表单数据:提前结束"
"java.io.IOException: Corrupt form data: premature ending"
在服务器上,我使用 com.oreilly.servlet 包来处理请求.
On the server I am using the com.oreilly.servlet package to handle the request.
我已经多次使用这个包来成功处理来自 flex 的文件上传,但由于某种原因,现在我遇到了这个问题.
I have used this package many times to successfully handle file uploads from flex, but for some reason, now I am having this problem.
这是一些更多信息的堆栈跟踪:
Here is the stack trace for some more info:
java.io.IOException: Corrupt form data: premature ending
at com.oreilly.servlet.multipart.MultipartParser.<init>(MultipartParser.java:205)
at com.oreilly.servlet.MultipartRequest.<init>(MultipartRequest.java:222)
at com.oreilly.servlet.MultipartRequest.<init>(MultipartRequest.java:173)
at com.mydomain.FileUploadServlet.doPost(FileUploadServlet.java:46)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:710)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:269)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:188)
at org.apache.struts2.dispatcher.ActionContextCleanUp.doFilter(ActionContextCleanUp.java:99)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:215)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:188)
at org.apache.struts2.dispatcher.FilterDispatcher.doFilter(FilterDispatcher.java:414)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:215)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:188)
推荐答案
com.orielly.servlet.MultipartRequest 类和 org.apache.struts2.dispatcher.ActionContextCleanUp 过滤器一起使用时,似乎存在一个错误.这就是导致小文件上传失败的原因.
It seems that there is a bug that exists when using com.orielly.servlet.MultipartRequest class and the org.apache.struts2.dispatcher.ActionContextCleanUp filter together. This is what was causing small file uploads to fail.
这篇关于损坏的表单数据:过早结束的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!