hibernate保存图片blob到oracle数据库

MultiPartRequestWrapper multipartRequest = (MultiPartRequestWrapper) getRequest();
File[] file
= multipartRequest.getFiles("file");// 获得文件
String[] filenames = multipartRequest.getFileNames("file");
for (int i = 0; i < filenames.length; i++){
  File f1
= file[i];
  
byte[] fileArray = org.springframework.util.FileCopyUtils.copyToByteArray(f1);
  JlsPhotos jlsPhotos
=new JlsPhotos();
  jlsPhotos.setPhoto(Hibernate.createBlob(fileArray));
  jlsPhotosManager.save(jlsPhotos);
}
ext前台代码
Ext.apply(this,{
fileUpload:
true,

items:[{
{
xtype :
'textfield',
fieldLabel:
'选择正面照片',
name :
'file',
width:
'300',
inputType:
'file'
}
posted @ 2011-05-09 12:47  meetrice  阅读(911)  评论(0编辑  收藏  举报