-1

I want to tell me How to save image to the mySQL after the user uploaded.
HINT : using NetBeans GUI Builder

This my code for choose image:

private void btnJFileChooserActionPerformed(java.awt.event.ActionEvent evt) {                                                
    JFileChooser fc = new JFileChooser();
    int result = fc.showOpenDialog(null);
    if (result == JFileChooser.APPROVE_OPTION) {
        File file = fc.getSelectedFile();
        try {
            image2.setIcon(new ImageIcon(ImageIO.read(file)));
        } catch (IOException e) {
            e.printStackTrace();
        }
    } 

This capture for Setter and Getter:
http://up07.s-oman.net/DVMGa.png

This capture for save button:
http://up07.s-oman.net/P2slSGkcj.png

OGHaza
  • 4,795
  • 7
  • 23
  • 29

1 Answers1

2

Did you try saving is as a blob? Here's the link to solution on Stack Overflow: insert BLOB file from Local to DB

Community
  • 1
  • 1
Lucas
  • 3,181
  • 4
  • 26
  • 45