note 43225 deleted from function.readfile by aidan
| From: | aidan@php.net | Date: | Fri, 24 Sep 2004 01:25:41 +0000 |
| Subject: | note 43225 deleted from function.readfile by aidan | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-77274@lists.php.net to get a copy of this message | ||
Note Submitter: Ethan J. Allison
----
I use a modified version the following code to allow people to download music from my server without
it opening in Winamp or Musicmatch or WMP or whatever they use. It works perfectly and uses the
minimal amount of needed headers. Thanks to everyone who commented here for helping me figure out
how to do this.
<?php
$file = "http://localhost/file-to-download.xyz";
header("Content-Description: File Transfer");
header("Content-Type: application/force-download");
header("Content-Disposition: attachment; filename=".basename($file));
@readfile($file);
?>