My Servlet code is here
protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
Part image = request.getPart("pic");
InputStream is =image.getInputStream();
byte[] targetArray= new byte[is.available()];
FileOutputStream fos = new FileOutputStream("F:\\image\\abc.jpg");
fos.write(targetArray);
is.close();
fos.close();
}
This code is working and saved file size is same as uploaded file but when I open it,it is damaged,