这都不会,唉
public boolean storeImage(String sqlstr,FormFile file){
try {
InputStream fin=file.getInputStream();
//byte[] img=file.getFileData();
ByteBuffer nbf=ByteBuffer.allocate(file.getFileSize());
byte[]array=new byte[1024];
int offset=0,length=0;
while((length=fin.read(array))>0){
if(length!=1024)
nbf.put(array,0,length);
else
nbf.put(array);
offset+=length;
}
fin.close();
byte[]content=nbf.array();
return setImage(sqlstr,content);
} catch (Exception e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
return false;
}