You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Wendy Cameron <ca...@usq.edu.au> on 2002/12/02 05:26:51 UTC

Files upload and inserting in database

I have a really simple question regarding, I understand that the database needs a file input stream using the following as an example of putting a file in the database:

File file = new File("myimage.gif");
FileInputStream fis = new FileInputStream(file);
PreparedStatement ps = conn.prepareStatement("INSERT INTO images VALUES (?, ?)");
ps.setString(1, file.getName());
ps.setBinaryStream(2, fis, file.length());
ps.executeUpdate();
ps.close();
fis.close();

However I dont know what type the Bean object property should be in order to allow RequestUtils to automatically  populate the bean property when multipart form content is used
thanks Wendy



--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>