[英]Is there a max limit for file upload using Apache FileUpload API?
[英]Stripes Framework file upload using apache fileupload
我一直在尝试将ck编辑器文件上传与使用Stripes 1.8开发的应用程序集成在一起,但未能成功。 从CK编辑器文件bowser(纯html)中,我可以找到一个处理文件上传功能的servlet。 但是,以下代码部分无法执行。
// get uploaded file list
// the following code uses commons-fileupload-1.3.1
// the imports are removed for crispiness of the code
FileItemFactory factory = new DiskFileItemFactory();
ServletFileUpload upload = new ServletFileUpload(factory);
if (ServletFileUpload.isMultipartContent(request)) {
try {
List files = upload.parseRequest(request); // returns an empty list
}catch (Exception e) { // no error handling}
e.printStackTrace();
}
}
原因可能是什么,并且有一些解决方法。 顺便说一句,相同的代码在Struts 1.3应用程序中可以很好地工作。
问题出在web.xml设置
<filter-mapping>
<filter-name>stripesFilter</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>
更改为
<filter-mapping>
<filter-name>stripesFilter</filter-name>
<url-pattern>/action/*</url-pattern>
</filter-mapping>
由于该请求经过了带区servlet过滤器,因此已经被解析。 由于该输入流已被该较早的过程占用,因此Commons FileUpload将不再可使用该输入流进行解析。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.