说明下,10月1日前可以上传图片,但是现在,图片上传时死在这个循环里面了,这是为什么呢?
String contentType = request.getContentType();
java.io.DataInputStream dis = new java.io.DataInputStream(request.getInputStream());
//read the content by byte
int formDataLength = request.getContentLength(); //可以取到长度
byte[] dataBytes = new byte[formDataLength]; //file cache
int byteRead = 0;
int totalBytesRead = 0;
while(totalBytesRead < formDataLength){
为什么到这里dis里面的东西好像空,取的的实际字节数为-1
byteRead = dis.read(dataBytes,totalBytesRead,formDataLength);
totalBytesRead += byteRead;
//死循环了,为什么??
}
String contentType = request.getContentType();
java.io.DataInputStream dis = new java.io.DataInputStream(request.getInputStream());
//read the content by byte
int formDataLength = request.getContentLength(); //可以取到长度
byte[] dataBytes = new byte[formDataLength]; //file cache
int byteRead = 0;
int totalBytesRead = 0;
while(totalBytesRead < formDataLength){
为什么到这里dis里面的东西好像空,取的的实际字节数为-1
byteRead = dis.read(dataBytes,totalBytesRead,formDataLength);
totalBytesRead += byteRead;
//死循环了,为什么??
}
解决方案 »
- 请问谁能详细解释一下下面这段代码
- 请问如何做到选择一个下拉选项而改变一个表单
- mouserover问题?
- 如何写js判断多选框是否有被选中的?在线等~
- 各位帮帮忙!打开窗口问题
- 为什么我的浏览器不能回复;确切的说,不能往csdn回复的地方写内容,能往上粘贴,不能直接写???????
- 急!在javascript中如何清除<div>中用insertAdjacentHTML方法加入的对象?
- 有框架结构的上菜单栏出现页面不稳定问题,答对者有分送
- 用JavaScript,有没有办法读写.............本地...........数据库(如MS Access)?
- !寻求JavaScript集成开发环境(IDE),JavaScript 特效
- js实现html根据参数自动生成行
- 欢迎讨论 Ajax封装
發到java版還差不多。