文件上传

上传
InputStream istream = pFile.getInputStream();
String filePath = request.getRealPath("/upload");
OutputStream ostream = new FileOutputStream(filePath+"\\"+filename);
int bytesRead = 0 ;
byte[] buffer = new byte[8192];

while((bytesRead = istream.read(buffer, 0, 8192)) != -1){
ostream.write(buffer,0,bytesRead);
}
ostream.close();
istream.close();

你可能感兴趣的:(文件上传)