第1个回答 2013-09-29
用InputStream打开该文件。
InputStream in =new FileInputStream("sdf.txt");
int size=in.available()
得到了size就是你该文件的字节数本回答被网友采纳
第2个回答 2013-09-29
file有个方法是.length专门获取文件大小,单位是B。
第3个回答 2013-09-29
这个是我写的InputStream stream = new FileInputStream(dir + "\\" + dest
+ ".xls");
long size=stream.available();
你看这个行不?
第4个回答 推荐于2016-04-15
上传的页面代码:
<form name="form1" method="post"
action="limitFileInTime.jsp" id="form1"
enctype="multipart/form-data"
target="upload_frame">
<input type="file" id="uploadfile" name="uploadfile">
<input type="button" name="Button1" value="上 传" id="Button1" class="btn" onclick="form1.submit()" />
</form>
limitFileInTime.jsp
<%
int len = request.getContentLength();
%>