Hi,
I would like to know how I can force to browser to start a download of a file from my site with the save-as dialog box. This is to ensure PDF, DOC, and music files are not loaded automatically.
Thanks!
Daniel Loh
[code=php]<?php $file = '/var/www/html/file-to-download.xyz'; header('Content-Description: File Transfer'); header('Content-Type: application/force-download'); header('Content-Length: ' . filesize($filename)); header('Content-Disposition: attachment; filename=' . basename($file)); readfile($file); ?>[/code]
Help @danlohye spread the word by sharing this article on Twitter...