Re: php file list with forced download

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Mon, May 16, 2005 5:49 pm, Miguel Vaz said:
> 	Was coding a directory listing for several dirs on a client's server that
> would list the files and allow users to download them. The question is, is
> there a way to force download of all files, regardless of their types?
> i.e., if the list constains a .jpg, the browser will show it instead of
> asking the user to download. Also for .html, gifs, etc.

<?php
  header("Content-type: application/octet-stream");
  readfile("/full/path/to/your/file");
?>

Any browser that doesn't force a download for application/octet-stream is
in violation of every HTTP protocol version ever published.

Even *MICROSOFT* hasn't screwed this one up.  Yet...

-- 
Like Music?
http://l-i-e.com/artists.htm

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


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux