Forums Register Login

FileOutputStream and JPG file.

+Pie Number of slices to send: Send
I use Applet to send a file to Servlet. Now my coding is only working for Text and small GIF icon. The saved file, if it is in JPG and large GIF file, will be corrupted.

How to fix it ?

Thanks.

applet : send a file


Servlet : receive a file
+Pie Number of slices to send: Send
Binary data (like an image file) is not character data - you can't convert it to a string. Just do a "out.write(buffer1, 0, bytesRead)" instead.
+Pie Number of slices to send: Send
We like to reserve this forum for "easy" questions, so I feel I shall have to move this thread.
+Pie Number of slices to send: Send
 

Ulf Dittmer wrote:Binary data (like an image file) is not character data - you can't convert it to a string. Just do a "out.write(buffer1, 0, bytesRead)" instead.


Thanks. it works.
Uh oh, we're definitely being carded. Here, show him this tiny ad:
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com


reply
reply
This thread has been viewed 3192 times.
Similar Threads
Transferring file name then file data over socket
Socket connection program works for localhost but not for other ip
Sending a file over socket
Using Apache Commons Codec
copying files over a network
java.io.IOException: Failed to write; [10053]
More...

All times above are in ranch (not your local) time.
The current ranch time is
Mar 28, 2024 11:36:06.