note 45908 modified in function.readfile by aidan

From: Date: Fri, 24 Sep 2004 01:25:48 +0000
Subject: note 45908 modified in function.readfile by aidan
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-77275@lists.php.net to get a copy of this message
If you want to force a download, like Ethan J. Allison, you can better use the local file name instead of the URL for the file. This way you can avoid some overhead on your webserver. <?php $file = "/var/www/html/file-to-download.xyz"; header("Content-Description: File Transfer"); header("Content-Type: application/force-download"); header("Content-Disposition: attachment; filename=".basename($file)); readfile($file); ?> --was-- If you want to force a download, like Ethan J. Allison, you can better use the local file name instead of the URL for the file. This way you can avoid some overhead on your webserver. <?php $file = "/var/www/html/file-to-download.xyz"; header("Content-Description: File Transfer"); header("Content-Type: application/force-download"); header("Content-Disposition: attachment; filename=".basename($file)); @readfile($file); ?> http://php.net/manual/en/function.readfile.php

« previous php.notes (#77275) next »