
Hi, I am working with java. In my application i want to give facility to user to add and change image. I use open dialog box to select image, it will work properly i.e on button click open dialog is open select any image
i want to store that selected image into specified folder and that path stored into database, for furhter retrivation.
Please guide me to overcome from that problem
Thanks and Regrads
Pushpa sheela

ImageIcon ic=(ImageIcon)PhotoLabel.getIcon();
OutputStream out = null;
int size=0;
try {
out = new FileOutputStream("c:/Photos/"+AdmissionNoText.getText()+".jpg");
} catch (FileNotFoundException ex) {
Logger.getLogger(StudentDataMaster.class.getName()).log(Level.SEVERE, null, ex);
}
byte[] b = new byte[size];
try {
out.write(b);
ImageIO.write(image, "jpg", out);
} catch (Exception ex) {
Logger.getLogger(StudentDataMaster.class.getName()).log(Level.SEVERE, null, ex);
}
If you are facing any programming issue, such as compilation errors or not able to find the code you are looking for.
Ask your questions, our development team will try to give answers to your questions.