binary file corrupted when downloading
843836Oct 11 2004 — edited Oct 19 2004Hi. I'm trying to download binary files using a JSP. This is my code:
<%
response.setContentType(report.getContent_type());
response.setHeader ("Content-Disposition", "attachment;filename=\""+report.getNombre()+"\"");
byte[] file = report.getFile();
ServletOutputStream sos = response.getOutputStream();
sos.write(file);
sos.close();
%>
It seems to work, but when i'm going to open the downloaded file, it's corrupted, and when I compare it with the original one, all bytes that follow the first '\0' character have been replaced by '\0'. The file size is the same, but not the content.
I'm using Websphere as application server. Maybe this problem is related with the server, or maybe I'm doing something wrong. Any ideas?
Thanks.