RE: [PHP] MSIE problem with binary file download over SSL
| From: | John W. Holmes | Date: | Tue, 08 Apr 2003 01:56:16 +0000 |
| Subject: | RE: [PHP] MSIE problem with binary file download over SSL | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-142777@lists.php.net to get a copy of this message | ||
Are you using sessions? There is a "feature" in IE that'll mess up
downloads over SSL when the session sends it's session.cache_limiter
value. If it's set to "nocache" then the download does not work. Setting
it to "none" or empty will allow you to do the file download.
---John W. Holmes...
PHP Architect - A monthly magazine for PHP Professionals. Get your copy
today. http://www.phparch.com/
> -----Original Message-----
> From: Rich Choy [mailto:versace_74@hotmail.com]
> Sent: Monday, April 07, 2003 8:47 PM
> To: php-general@lists.php.net
> Subject: [PHP] MSIE problem with binary file download over SSL
>
> Hi,
>
> I have a script that retrieves binary blob data from a database and
sends
> it
> to the client browser via SSL. It works like a charm for all browsers
> except
> for MSIE. I can assure you that the problem has nothing to do with the
way
> I've set up my headers; after a bit of investigation I've figured out
that
> MSIE has a problem with my script when it sends data over SSL. I have
> tested
> the script with MSIE over a regular port 80 connection and the
download
> script works just fine.
>
> I am running Apache 1.3.6 + OpenSSL 0.9.6g + PHP 4.1.2. Does anyone
know a
> workaround to this problem? I have looked all over the web to no
avail.
> Any
> help is appreciated.
>
> Thanks in advance,
>
> Rich
>
> Here's the download script:
>
> [begin php]
>
> <?
> include("_srs/res_common_sdx_admin.inc");
> include("_srs/res_auth_admin.inc");
>
> $id = $_GET['id'];
>
> if ($id) {
> // if record id was specified
>
> @include("res_db.inc");
> // connect to database
>
> $db_q['lit'] = "select * from sdx_literature where id = $id";
> $db_r['lit'] = mysql_query($db_q['lit']);
>
> if (mysql_num_rows($db_r['lit'])==1) {
> // if record exists
>
> $lit = mysql_fetch_array($db_r['lit']);
> // fetch literature record
>
> $file_description = $lit['description'];
> $file_name = $lit['filename'];
> $file_size = $lit['byte_size'];
> $mime_type = $lit['mime_type'];
> $binary_data = $lit['binary_data'];
>
> if (preg_match('/MSIE 5.5/', $_ENV['HTTP_USER_AGENT']) ||
> preg_match('/MSIE 6.0/', $_ENV['HTTP_USER_AGENT'])) {
>
> header("Content-Disposition: filename=$file_name");
> header("Content-Type: application/zip");
> // headers for MSIE
>
> } else {
>
> header("Content-Disposition: attachment;
> filename=$file_name");
> header("Content-Type: $mime_type");
> // headers for WC3-compliant clients
>
> }
>
> header("Content-Length:$file_size");
> header("Content-Transfer-Encoding: binary");
> header("Content-Description: $file_description");
> // common headers
>
> echo $binary_data;
> // send binary data to client
>
> } else {
> // if record does not exist
>
> $_SESSION['msg'] = "Invalid literature record ID.";
> // error message
>
> }
>
> } else {
> // if record id was not specified
>
> $_SESSION['msg'] = "The script you are trying to access
requires a
> valid literature record ID.";
> // error message
>
> }
>
> header("Location: error.php");
> // redirect to error notification script
>
>
> ?>
> [end php]
>
>
>
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php