Flex 与 Java 上传ByteArray图片数据
Flex 端的上传代码:
String filePath = "c:/test.png"; InputStream inputStream = request.getInputStream(); FileOutputStream outputStream = new FileOutputStream(new File(filePath)); int formlength = request.getContentLength();byte[] formcontent = new byte[formlength];int totalread = 0;int nowread = 0;while (totalread < formlength) {nowread = inputStream.read(formcontent, totalread, formlength);totalread += nowread;} outputStream.write(formcontent); outputStream.flush(); outputStream.close(); inputStream.close();
?