上传文件
String filePath = "c:/";
String fileName = request.getParameter("title");
InputStream inputStream =request.getInputStream();
FileOutputStream outputStream = new FileOutputStream(new File(filePath+fileName+".png"));
//int formlength = request.getContentLength();
int formlength = Integer.parseInt(request.getParameter("file"));
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();