【问题标题】:How to save image to mySQL which the user have uploaded如何将图像保存到用户已上传的 mySQL
【发布时间】:2013-12-23 21:31:55
【问题描述】:

我想告诉我用户上传后如何将图像保存到 mySQL。
提示:使用 NetBeans GUI Builder

这是我选择图片的代码:

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();
        }
    } 

Setter 和 Getter 的捕获:
http://up07.s-oman.net/DVMGa.png

此捕获用于保存按钮:
http://up07.s-oman.net/P2slSGkcj.png

【问题讨论】:

  • 在继续之前查看答案to this

标签: java mysql image


【解决方案1】:

您是否尝试将其保存为 blob?这是 Stack Overflow 上的解决方案链接:insert BLOB file from Local to DB

【讨论】:

  • 如何在setter和getter方法中定义图片??
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 2022-09-23
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2015-05-16
  • 1970-01-01
相关资源
最近更新 更多