A
ADH
Hi:
I'm writing a simple Web application that gets image data from a
third-party applet and writes it to a specified directory on a Web
server (this is done using a JSP and a JavaBean handling the file
upload.)
When I upload any *.jpg and attempt to write it to the server,
however, the size of the copied image on the server directory is
exactly the same, but when I try to open the file, I get "No Preview
Available" from Windows Picture and Fax Viewer, "Can't determine type"
from Microsoft Photo Editor, etc.
Here is the code that I used to read from the applet source and write
to the server:
try {
// get the image input from applet
ServletInputStream in = request.getInputStream();
FileOutputStream ostrm = new FileOutputStream("picture4.jpg");
byte[] readArray = new byte[1];
while((in.read(readArray)) != -1)
{
ostrm.write(readArray);
}
// close all streams
in.close();
ostrm.close();
return true;
} catch (Exception e) {
System.out.println("check console");
return false;
}
}
Can anyone help me out?
I'm writing a simple Web application that gets image data from a
third-party applet and writes it to a specified directory on a Web
server (this is done using a JSP and a JavaBean handling the file
upload.)
When I upload any *.jpg and attempt to write it to the server,
however, the size of the copied image on the server directory is
exactly the same, but when I try to open the file, I get "No Preview
Available" from Windows Picture and Fax Viewer, "Can't determine type"
from Microsoft Photo Editor, etc.
Here is the code that I used to read from the applet source and write
to the server:
try {
// get the image input from applet
ServletInputStream in = request.getInputStream();
FileOutputStream ostrm = new FileOutputStream("picture4.jpg");
byte[] readArray = new byte[1];
while((in.read(readArray)) != -1)
{
ostrm.write(readArray);
}
// close all streams
in.close();
ostrm.close();
return true;
} catch (Exception e) {
System.out.println("check console");
return false;
}
}
Can anyone help me out?