'filename' problem... heeeelp! :)

From: larco (larco.SPAM377gHFDyg64dGFDGsuysffytENDSPAM_at_o2.pl)
Date: 11/29/03


Date: Sat, 29 Nov 2003 04:18:10 +0100

Hi!

This script is for file download. But when the 'save' window pop-up, it
displays .... this script's name, not the file name...

Any ideas?

<?php

 $filename = "hehehe.jpg";
 $directory = "."; // for this example is set to current

 $dl_full = $directory . "/" . $filename;
 $dl_name = $filename;

 if (!file_exists($dl_full))
 {
  echo"File <b>$dl_name</b> does not exist.";
  exit();
 }

 header("Content-Type: application/octet-stream");
 header("Content-Disposition: attachment; filename=$dl_name");
 header("Content-Length: ".filesize($dl_full));
 header("Accept-Ranges: bytes");
 header("Pragma: no-cache");
 header("Expires: 0");
 header("Cache-Control: must-revalidate, post-check=0, pre-check=0");
 header("Content-transfer-encoding: binary");

 @readfile($dl_full);

?>

Jarek.



Relevant Pages

  • Encrypted File Transfer
    ... I need to implement an encrypted File download with ... a PHP script on the server side and a c# client application. ...
    (comp.lang.php)
  • Re: Web server with PHP setup & mod-ssl
    ... > as a file download and dumps the file to my desktop. ... You will need to set up php in both apache AND apache-ssl. ...
    (Debian-User)
  • Re: php not parsing
    ... <?php phpinfo(); ?> ... | File Download ... | I'm not certain why it's not parsing php. ... | and I've checked my Apache conf. ...
    (alt.php)
  • File Download dialog problem
    ... I can't seem to get the file download dialog to appear, ... $csv = array; ... Pat Buxton ...
    (alt.php)
  • Re: PHP scripts and IE
    ... "Tony Wainwright" wrote in message ... > just trying to get to grips with these tools and am following a book PHP, ... I click the send button and I get a File Download ...
    (alt.php)