int pos;
pos=file.indexOf("filename=\"");
pos=file.indexOf("\n",pos)+1;
pos=file.indexOf("\n",pos)+1;
pos=file.indexOf("\n",pos)+1;
int boundarylocation=file.indexOf(boundary,pos)-4;
int startpos=((file.substring(0,pos)).getBytes()).length;
int endpos=((file.substring(0,boundarylocation)).getBytes()).length;
File checkFile=new File(fileName);
if(checkFile.exists()){//如果文件已经存在则删除 checkFile.delete(); }
File fileDir=new File(rootPath);
if(!fileDir.exists()){ fileDir.mkdirs(); }
fileOut=new FileOutputStream(fileName);
fileOut.write(dataBytes,startpos,(endpos-startpos));
fileOut.close();
String get_id=session.getAttribute("set_id").toString();
inf.setId(get_id);
session.removeAttribute("set_id");
inf.setPicture(str_write);
boolean tts=inf.update_picture();