【发布时间】:2013-08-06 10:03:26
【问题描述】:
//或任何其他将多部分文件保存到数据库的解决方案。 我尝试过这种方式,但出现错误。
File fileOne = new File("file.getOrignalFileName");//what should be kept inside this method
byte[] bFile = new byte[(int) fileOne.length()];
try {
FileInputStream fileInputStream = new FileInputStream(fileOne);
//convert file into array of bytes
fileInputStream.read(bFile);
fileInputStream.close();
} catch (Exception e) {
e.printStackTrace();
}
questionDao.saveImage(bFile);
【问题讨论】:
-
你遇到了什么错误?
-
您遇到什么错误?它是如何保存在数据库中的(是否使用 ORM 映射?)正在使用哪种 Multipart 文件(MIME、JMS、..)?
-
我正在尝试使用 ORM 映射来获取图像文件(png),它会工作吗