Dara Dowd wrote:
Thanks for the advice lads but I realise I should have been clearer. I know about header(etc..) so displaying the download dialog isn't the problem, it's how to get to the file on the file server and then open it. The file server isn't a web server.  This is probably ridiculously easy so I hope I'm not wasting your time. I don't want to@use the 'right-click' option, I want something similar to@opening attachments in hotmail for example. Here's what I have anyway.
<?php

if (isset($_GET["fname"])){

  $fpath="file://fileserver/directory/";
  $fname=$_GET["fname"];
  $filename=$fpath.$fname;

  $filelength=filesize($filename);

  header("Content-type: application/stream");
  header("Content-Length: $filelength");
  header("Content-Disposition: attachment; ");

 $fp=fopen($filename,"rb");
 print(fread($fp,$filelength));
 fclose($fp);
}
?>

Cheers, Dara
What kind of network are you using?
If you're accessing a SMB-share (i.e. Windows or Samba) I think you need to skip "file:" from your script. Maybe you need to use backslashes instead ($fpath="file:\\\\fileserver\\directory\\").

Regards
Joakim


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

Reply via email to