jakarta commons file upload and store to mysql

Discussion in 'Java' started by Joshua, Oct 20, 2004.

  1. Joshua

    Joshua Guest

    After a few hours digging around I found a few API's available to
    provide file upload functionality. I decided to go with the jakarta
    commons file upload classes. I can successfully upload a file,
    storing it to disk on the server. I don't want to store a URL to
    uploaded files in a table record, and so would rather store the file
    itself in a record. I'm using MySql, and so assume I will use the
    field type Blob.

    Looking at the apache site [1] for customisation information there is
    no documentation available. So looking at the available methods of
    the FileItem class I can only assume I use the
    FileItem.getInputStream() method to pull the contents of the file.

    My question is, how do I transfer the contains of the file from the
    returned java.io.InputStream into a blob mysql field, if blob is the
    way forward of course.

    I am using the com.mysql.jdbc.Driver JDBC driver downloaded from
    mysql.com.

    Any help much appreciated.

    [1] http://jakarta.apache.org/commons/fileupload/customizing.html
     
    Joshua, Oct 20, 2004
    #1
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Dundonald
    Replies:
    0
    Views:
    397
    Dundonald
    Mar 22, 2005
  2. Dundonald
    Replies:
    2
    Views:
    895
    Dundonald
    Mar 23, 2005
  3. elektrophyte

    Jakarta Commons IO file filters

    elektrophyte, Aug 18, 2005, in forum: Java
    Replies:
    1
    Views:
    505
    Roedy Green
    Aug 22, 2005
  4. i730lover
    Replies:
    0
    Views:
    781
    i730lover
    Jul 21, 2006
  5. Joe Linux
    Replies:
    0
    Views:
    651
    Joe Linux
    Sep 15, 2006
Loading...

Share This Page