MultipartRequest multi = null;
Enumeration filenames = null;
multi=new MultipartRequest(request,saveDirectory,maxPostSize,language);
File attachedFile = null;
InputStream attachedFileStream=null;
int attachedFilelength = 0;
filenames = multi.getFileNames();
while(filenames.hasMoreElements()){
String names = (String) filenames.nextElement();
String fname = multi.getFilesystemName(names);
attachedFile = new File(fname);
attachedFilelength = (int) attachedFile.length();
attachedFileStream = new FileInputStream(attachedFile);
pstmt.setBinaryStream (i++, attachedFileStream, attachedFilelength);
}
因為不能po太多
所以我把遇到問題的部分寫出來^^"
我知道存入檔案名稱的寫法可以用
multi.getFilesystemName((String)filenames.nextElement())
但是寫入檔案實體存成二進位資料的部份
之前用ArrayList裝檔案實體會有問題
因為用Enumeration.hasMoreElements()
會不好從list抓出來用
照上面這樣寫的話會有NullpointerException
沒頭緒...File這樣塞不對嗎?
好像很少人會這樣存吧...還是請教一下...
真的很難找= ="
--
※ 發信站: 批踢踢實業坊(ptt.cc)
◆ From: 202.173.49.133