Hi all,

I've seen some posts and info elsewhere regarding downloading files - mostly
stating problems with the way IE handles this function.

What I'm trying to do is :
    1 - offer files,.. .doc, .zip and others
    2 - allow the user to click on a URL, or button
    3 - have the options to Open or Save
    4 - NOT have MS-Word come up within the browser window if user
         chooses to Open
    5 - IE save the file properly

Netscape seems to do all the rights things. But I want to get IE working,
(as best I can).

I'm using the following code-snippet within a PHP script,... browser type
gets checked earlier in the script,..

Currently, to avoid IE displaying .doc files within its window, I've
prevented the user from 'left-clicking' on the file's anchor with some
simple JS and forcing them to do a Save-As, which seems to work for IE, but
Netscape defaults to the URL for the name of the file :-(

Is there a better way to achieve all of the above ??

Is it possible to stop IE from opening the .doc within its browser window ??

Any advice would be greatly appreciated.

Thanks,

Jim.....

  // get the filename
  $filename = $dataDIR . $fileid . ".dat";

  if ($browserType == "IE") {
      $attachment="";
  } else {
      $attachment="attachment;";
  }
    $attachment="";
    $fn=urldecode($realname);

    header('Content-Disposition:'.$attachment.' filename="'.$fn.'"');
    header('Content-Type: application/octet-stream');
    header('Content-Description: download file from site');
    header('Content-Length: '.filesize($filename) );
    header('Pragma: no-cache');
    header('Expires: 0');

    readfile($filename);



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to