当文件大小大于2gb时,request.getContentLength()返回0 [英] request.getContentLength() return 0 when file size is greater than 2gb
问题描述
在我的项目中使用文件上传:
< s:form id =uploadDataaction =UploadAction namespace =xyzvalidateFields =falsemethod =postenctype =multipart / form-data>
但是request.getContentLength()方法返回小于2 gb的正确值,它。
$ b 可能的原因是内容长度的
数据类型为int。有没有其他的方式,请求参数:content-length可以转换为长型
,以支持大于2GB的上传。
这是因为 code> INT 。实际上,它应该为大于2GB的文件(请求)返回 如果你使用Servlet API 3.1(例如Tomcat 8),您可以使用 getContentLengthLong()方法。 Using a file upload in my project as : But the request.getContentLength() method returns correct value for less than 2 gb and 0 for anything above it. The probable reason being
datatype of the content-length as int. Is there any other way where the request parameter: content-length can be converted into long type
in order to support uploads greater than 2gb. please guide us how to convert the content length request header to long to support file upload greater than 2gb It's because the getContentLength() method in the Servlet API is defined as If you're using Servlet API 3.1 (e.g. Tomcat 8), you can use getContentLengthLong() method. 这篇关于当文件大小大于2gb时,request.getContentLength()返回0的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋! -1
。
<s:form id="uploadData" action="UploadAction" namespace="xyz" validateFields="false" method="post" enctype="multipart/form-data">
int
. Actually, it should return -1
for files (requests) bigger than 2gb.