aspose file tools*
The moose likes JSP and the fly likes File Download Problem:GIF,DOC Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of EJB 3 in Action this week in the EJB and other Java EE Technologies forum!
JavaRanch » Java Forums » Java » JSP
Bookmark "File Download Problem:GIF,DOC" Watch "File Download Problem:GIF,DOC" New topic
Author

File Download Problem:GIF,DOC

roul ravashimka
Ranch Hand

Joined: Mar 16, 2004
Posts: 53
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


MSc Electronics, ICT
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 60041
    
  65

"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


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
 
subject: File Download Problem:GIF,DOC
 
Similar Threads
cannot name inline pdf file...
File Upload
copy to app server
Weblogic and the downloading of documents
file download