Win a copy of Re-engineering Legacy Software this week in the Refactoring forum
or Docker in Action in the Agile forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

File Download Problem:GIF,DOC

 
roul ravashimka
Ranch Hand
Posts: 53
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello JavaRanchers,
i've got a problem when i download gifs,docs,..
it works well for pdf,zip,txt,mp3,html
but not for gifs,jpegs,avis,docs.
my code is:
<%@ page language="java" %>
<%
response.setContentType("APPLICATION/OCTET-STREAM");
response.setHeader("Content-Disposition","attachment; filename=\""+ request.getAttribute("filename") + "\"");
java.io.FileInputStream fileInputStream = new java.io.FileInputStream("c:\\uploads\\"+(String)request.getAttribute("fileid"));
int i;
while((i=fileInputStream.read())!= -1){
fout.write(i);
}
fileInputStream.close();
fout.close();
%>
Is ther a difference between a pdf(which works) and a gif(which doesnt worok)?
Or do i have to use other streams?
Thx,
Roul
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 64623
86
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
"Roul rv",
We're pleased to have you here with us in the JSP forum, but there are a few rules that need to be followed, and one is that proper names are required. Please take a look at the JavaRanch Naming Policy and adjust your display name to match it.
In particular, your display name must be a first and a last name separated by a space character, and must not be obviously fictitious.
Thanks!
bear
Forum Bartender
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic