Bluehost.com Web Hosting $6.95

Internet Explorer 6 refusing to let me download

This is a discussion on Internet Explorer 6 refusing to let me download within the PHP Language forums, part of the PHP Programming Forums category; Hi, This problem only affects PC IE. On a secured page (a page visited via https), there is a link ...


Go Back   Usenet Forums > PHP Programming Forums > PHP Language

FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #1 (permalink)  
Old 10-26-2006
laredotornado@zipmail.com
 
Posts: n/a
Default Internet Explorer 6 refusing to let me download

Hi,

This problem only affects PC IE. On a secured page (a page visited via
https), there is a link that reads -- "Download HTML File". The link
connects to this page

<?php
require("../../util_fns.php");

session_start();

$user_id = $_REQUEST[USER_ID_PARAM];
$file_contents = generateLoginFile($user_id);

header('Content-Type: text/html');
header('Content-Length:' . strlen($file_contents));
header('Content-Disposition: attachment; filename="' .
str_replace("%s", getCompanyName($user_id), AUTO_LOGIN_FILE_TITLE) .
'.html"');

print $file_contents;
?>

However, on Internet Explorer, when I'm prompted to save the file, I
click "Save" and then get an error message stating, "Internet Explorer
cannot download ...ate_login_file.php?UserId=2 from
mysite.mydomain.com.

Internet Explorer was not able to open the Internet site. The
requested site is either unavailable or cannot be found. Please try
again later."

Is there something wrong iwth one of the headers I'm sending? I'm
using PHP 4.4.4.

Thanks, - Dave

Reply With Quote
  #2 (permalink)  
Old 10-26-2006
Andy Hassall
 
Posts: n/a
Default Re: Internet Explorer 6 refusing to let me download

On 25 Oct 2006 15:24:54 -0700, "laredotornado@zipmail.com"
<laredotornado@zipmail.com> wrote:

>This problem only affects PC IE. On a secured page (a page visited via
>https), there is a link that reads -- "Download HTML File". The link
>connects to this page
>
><?php
> require("../../util_fns.php");
>
> session_start();
>
> $user_id = $_REQUEST[USER_ID_PARAM];
> $file_contents = generateLoginFile($user_id);
>
> header('Content-Type: text/html');
> header('Content-Length:' . strlen($file_contents));
> header('Content-Disposition: attachment; filename="' .
>str_replace("%s", getCompanyName($user_id), AUTO_LOGIN_FILE_TITLE) .
>'.html"');
>
> print $file_contents;
>?>
>
>However, on Internet Explorer, when I'm prompted to save the file, I
>click "Save" and then get an error message stating, "Internet Explorer
>cannot download ...ate_login_file.php?UserId=2 from
>mysite.mydomain.com.
>
>Internet Explorer was not able to open the Internet site. The
>requested site is either unavailable or cannot be found. Please try
>again later."
>
>Is there something wrong iwth one of the headers I'm sending? I'm
>using PHP 4.4.4.


session_start() by default sends a cache control header including "no-store".
Internet Explorer takes this a bit too literally, but doesn't have appropriate
error handling for the case, and as a result explodes cryptically when you
attempt to save the output page to disk.

Before session_start(), add "session_cache_limiter('none');", or look up that
function and tweak the limiter as appropriate (probably 'private' is closer to
the mark).

--
Andy Hassall :: andy@andyh.co.uk :: http://www.andyh.co.uk
http://www.andyhsoftware.co.uk/space :: disk and FTP usage analysis tool
Reply With Quote
  #3 (permalink)  
Old 10-26-2006
Tim Roberts
 
Posts: n/a
Default Re: Internet Explorer 6 refusing to let me download

"laredotornado@zipmail.com" <laredotornado@zipmail.com> wrote:
>
>This problem only affects PC IE. On a secured page (a page visited via
>https), there is a link that reads -- "Download HTML File". The link
>connects to this page
>
><?php
> require("../../util_fns.php");
>
> session_start();
>
> $user_id = $_REQUEST[USER_ID_PARAM];
> $file_contents = generateLoginFile($user_id);
>
> header('Content-Type: text/html');
> header('Content-Length:' . strlen($file_contents));
> header('Content-Disposition: attachment; filename="' .
>str_replace("%s", getCompanyName($user_id), AUTO_LOGIN_FILE_TITLE) .
>'.html"');


Your headers are lying. You are not sending text/html content. IE can be
somewhat picky about the headers. Try this:

header('Content-Type: application/download');
--
Tim Roberts, timr@probo.com
Providenza & Boekelheide, Inc.
Reply With Quote
  #4 (permalink)  
Old 10-26-2006
laredotornado@zipmail.com
 
Posts: n/a
Default Re: Internet Explorer 6 refusing to let me download

Wow, you're good. Adding

session_cache_limiter('none');

prior to the session_start() directive worked.

Thanks, - Dave

Andy Hassall wrote:
> On 25 Oct 2006 15:24:54 -0700, "laredotornado@zipmail.com"
> <laredotornado@zipmail.com> wrote:
>
> >This problem only affects PC IE. On a secured page (a page visited via
> >https), there is a link that reads -- "Download HTML File". The link
> >connects to this page
> >
> ><?php
> > require("../../util_fns.php");
> >
> > session_start();
> >
> > $user_id = $_REQUEST[USER_ID_PARAM];
> > $file_contents = generateLoginFile($user_id);
> >
> > header('Content-Type: text/html');
> > header('Content-Length:' . strlen($file_contents));
> > header('Content-Disposition: attachment; filename="' .
> >str_replace("%s", getCompanyName($user_id), AUTO_LOGIN_FILE_TITLE) .
> >'.html"');
> >
> > print $file_contents;
> >?>
> >
> >However, on Internet Explorer, when I'm prompted to save the file, I
> >click "Save" and then get an error message stating, "Internet Explorer
> >cannot download ...ate_login_file.php?UserId=2 from
> >mysite.mydomain.com.
> >
> >Internet Explorer was not able to open the Internet site. The
> >requested site is either unavailable or cannot be found. Please try
> >again later."
> >
> >Is there something wrong iwth one of the headers I'm sending? I'm
> >using PHP 4.4.4.

>
> session_start() by default sends a cache control header including "no-store".
> Internet Explorer takes this a bit too literally, but doesn't have appropriate
> error handling for the case, and as a result explodes cryptically when you
> attempt to save the output page to disk.
>
> Before session_start(), add "session_cache_limiter('none');", or look up that
> function and tweak the limiter as appropriate (probably 'private' is closer to
> the mark).
>
> --
> Andy Hassall :: andy@andyh.co.uk :: http://www.andyh.co.uk
> http://www.andyhsoftware.co.uk/space :: disk and FTP usage analysis tool


Reply With Quote
Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are Off
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On




All times are GMT +1. The time now is 12:25 PM.


Powered by vBulletin® Version 3.7.3
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO 3.0.0