wood burning stoves 2.0*
The moose likes Servlets and the fly likes CANNOT download file from https in IE 6 Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of OCM Java EE 6 Enterprise Architect Exam Guide this week in the OCMJEA forum!
JavaRanch » Java Forums » Java » Servlets
Bookmark "CANNOT download file from https in IE 6" Watch "CANNOT download file from https in IE 6" New topic
Author

CANNOT download file from https in IE 6

Salman Moha
Greenhorn

Joined: Jul 19, 2005
Posts: 12
I have a similar problem. When I am trying to save/open a file from server(secure) which uses HTTPS, its displaying error message:

Internet Explorer cannot download ...File_name.doc from Server_name.
Internet Explorer was not able to open this Internet site. The requested site is either unavailable or cannot be found. Please try again later.

My code is below. Please help me out.
Its working with my localhost(http) and with Firefix browser. Its something to do with http and IE 6.


<java>
if (!request.getScheme().equals("https"))
response.setHeader("Pragma", "no-cache");

String fileName=request.getParameter("instruction");
//filename = filename.replaceAll( "\\W*", "" ) ;
String DirName = request.getParameter("directory");
String value = (DirName+"/"+fileName);

File f = new File (value);
response.setContentType("application/msword");
//set the header and also the Name by which user will be prompted to save
response.setHeader("Content-disposition", "attachment; filename=" + fileName);

InputStream in = new FileInputStream(f);
out.clearBuffer();

int bit = 256;
int i = 0;

try {

while ((bit) >= 0) {
bit = in.read();

out.write(bit);
}

} catch (IOException ioe) {
ioe.printStackTrace(System.out);
}

out.flush();
out.close();
in.close();
</java>
Marilyn de Queiroz
Sheriff

Joined: Jul 22, 2000
Posts: 9044
    
  10
Just a thought. If you are using WinXP, perhaps a firewall is interfering?


JavaBeginnersFaq
"Yesterday is history, tomorrow is a mystery, and today is a gift; that's why they call it the present." Eleanor Roosevelt
Salman Moha
Greenhorn

Joined: Jul 19, 2005
Posts: 12
Hi there.

Its working well with the firefox browser. I checked out without XP firewall.

When I click the link to open/ download a word file, its showing the (File Download warning) content disposition window but when I click save or open,,, I get error message "Internet Explorer cannot download ...File_name.doc from Server_name.
Internet Explorer was not able to open this Internet site. The requested site is either unavailable or cannot be found. Please try again later. "

In the content disposition window ( file download warning window), "File Name" is the filename path, and "From" is the server name/path. but nothing is displayed in "File Type"! Hope this might have something to do. Please help me out.


My code is as follows
if (!request.getScheme().equals("https"))
response.setHeader("Pragma", "no-cache");

String fileName=request.getParameter("instruction");
//filename = filename.replaceAll( "\\W*", "" ) ;
String DirName = request.getParameter("directory");
String value = (DirName+"/"+fileName);

File f = new File (value);
response.setContentType("application/msword");
//set the header and also the Name by which user will be prompted to save
response.setHeader("Content-disposition", "attachment; filename=" + fileName);
response.setHeader("Cache-Control", "cache");
response.setHeader("Cache-Control", "must-revalidate");
InputStream in = new FileInputStream(f);
out.clearBuffer();

int bit = 256;
int i = 0;

try {

while ((bit) >= 0) {
bit = in.read();

out.write(bit);
}

} catch (IOException ioe) {
ioe.printStackTrace(System.out);
}

out.flush();
out.close();
in.close();
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: CANNOT download file from https in IE 6