jQuery in Action, 2nd edition*
The moose likes EJB and other Java EE Technologies and the fly likes File Upload Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » EJB and other Java EE Technologies
Bookmark "File Upload" Watch "File Upload" New topic
Author

File Upload

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
Sergiu Truta
Ranch Hand

Joined: Dec 16, 2003
Posts: 121
I'm not really sure you posted this on the right forum. You should try the JSP forum instead.
Good luck.


...watch me...as I'm walking the path...
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: File Upload
 
Similar Threads
Weblogic and the downloading of documents
getResource(fileName)
File Download Problem:GIF,DOC
copy to app server
cannot name inline pdf file...