We use Struts to Upload files and store them as BLOB's in DB2. We have
code similar to the following:
**FORM**
public void setufile(org.apache.struts.upload.FormFile uFile) {
this.uFile = uFile;
}
private org.apache.struts.upload.FormFile getUFile () {
return uFile;
}
**ACTION**
UploadMessageForm upload = (UploadMessageForm)form;
..more code here for setting up insert...
pstmt = conn.prepareStatement( query );
pstmt.setBinaryStream(1, file.getInputStream()
,file.getInputStream().available() );
pstmt.execute();
The variable "file" is the value returned from upload.getUFile().
Hope this helps.
Daniel
-----Original Message-----
From: Ivan Vasquez [mailto:[EMAIL PROTECTED]
Sent: Friday, August 20, 2004 1:04 PM
To: [EMAIL PROTECTED]
Subject: Uploading files to a database
Hi,
What's the preferred way to upload files into a database in a J2EE Web
application?
Is there any way to stream the file straight from the HttpServletRequest
to the database without staging it in the server's filesystem?
Thank you,
Ivan.
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]