我想用mysql中的longblob存图片或者BT的种子,但是写完代码后发现只可以上传TXT,和XLS文件.这是怎么回事啊.
public void fileToField(String movie_name,String title,String type_id,String infile) throws Exception {
FileInputStream fis = null;
Connection conn = null;
try {
conn = DBAsource.getConnection();
file = new File(infile);
fis = new FileInputStream(file);
//文件后缀名
String file_type = infile.substring(infile.lastIndexOf( ". ") + 1, infile.length());
pstmt = conn.prepareStatement( "insert into bt_movie_info_t(movie_name,title,type_id,file_type,movie_dsc) values( ' "+movie_name+ " ', ' "+title+ " ', ' "+type_id+ " ', ' "+file_type+ " ',?) ");
pstmt.setBinaryStream(1,fis,fis.available()); //第二个参数为文件的内容
pstmt.executeUpdate();