it is simple code but it works.
tt is path file that you should get from form.
in FileOutput write the path that you want to save image.
if (tt !=null && tt.length()>1){
InputStream ff = new FileInputStream(tt);
int size = ff.available();
byte[] bb = new byte[size];
ff.read(bb);
OutputStream fo = new FileOutputStream("C:/Documents and Settings/Shahab/jbproject/datting/WebModule1/images/"+uid+username+".jpg"); fo.write(bb);
}