2

I'm using this code to let my users download files :

header('Content-Type: application/octet-stream');
    header("Content-Transfer-Encoding: Binary"); 
    header("Content-disposition: attachment; filename=\"" . basename($file_url) . "\""); 
    readfile($file_url); // do the double-download-dance (dirty but worky)
    header("refresh:0;url= $base_url");

The problem is, I have lots of different file types like zip , flv , pdf and so on .

my codes says that all those files are exe files .

How can I let browser download manager detect the file type?

Thanks

mahdi yamani
  • 923
  • 3
  • 12
  • 29
  • Read about fileinfo http://php.net/manual/en/book.fileinfo.php and send valid Conent-Type header, or check this http://stackoverflow.com/questions/386845/http-headers-for-file-downloads here can be answer for your questions – szapio Feb 06 '15 at 07:35

0 Answers0