Need help with Image upload to database
Hii all,
Firstly, I'm rather new to Java technology and I'm currently working on a school project. I need some help with:
uploading of an image file to an online database server(MySQL) and,
retrieving the image from db(I'm using BLOB type) for display in Java.
I'm not familiar with the classes/methods to be used. Can someone help me here? Thanks!
[385 byte] By [
marc79] at [2007-9-30 18:23:38]

Hi, thanks for the link.It has cleared some of my questions, but it does not show how I can do a File Select with Javax so that the user can choose an image instead of hardcoding it into the program. How can that be done in Java? Thanks!
Thanks for the link! I'm able to do a File Select via JFileChooser and display the image onto a JLabel using the ImageIcon method (many thanks for that!). Currently, this is what I have (ImageFilter() extends FileFilter):
ImageIcon photoIcon;
JLabel photoLabel = new JLabel();
JFileChooser fc = new JFileChooser();
<snip>
private JPanel DPCtr()
{
<snip>
photoIcon = new ImageIcon("default.jpg");
photoLabel.setIcon(photoIcon);
photoLabel.setPreferredSize(new Dimension(150, 150));
<snip>
return p;
}
<snip>
public void actionPerformed(ActionEvent a)
{
if (a.getSource() == browseBut) {
fc.setFileFilter(new ImageFilter());
int returnVal = fc.showOpenDialog(DiseasePane.this);
if (returnVal == JFileChooser.APPROVE_OPTION) {
File imgFile = fc.getSelectedFile();
try {
photoIcon = new ImageIcon(imgFile.toURL());
} catch (MalformedURLException e) {
System.err.println("Invalid URL");
}
photoLabel.setIcon(photoIcon);
}
}
}