// 获得文件内容:
InputStream is = part.getInputStream();
// 获得upload的路径:
String path = this.getServletContext().getRealPath("/upload");
OutputStream os = new FileOutputStream(path+"/"+fileName);
byte[] b = new byte[1024];
int len = 0;
while((len = is.read(b))!=-1){
os.write(b, 0, len); }