Problem downloading a file through the servlet. The file download happens, but shows only 0 bytes as its content. sample code of the setting of the headers is shown below: response.setHeader("Content-Length",String.valueOf(fDownloadFile.length())); response.setContentType("application/octet-stream"); response.setHeader("Content-Disposition","attachment;Filename=" + fDownloadFile.getName());
Please tell me if the reason for this not happening. rgds, Raghu
posted 12 years ago
I don't know about the "Content-Disposition" header. Don't you have to open the input stream of your file and write the bytes to the response output stream of the servlet yourself?