Win a copy of Mesos in Action this week in the Cloud/Virtualizaton forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

File Upload

 
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
 
Sergiu Truta
Ranch Hand
Posts: 121
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I'm not really sure you posted this on the right forum. You should try the JSP forum instead.
Good luck.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic