straight from http://php.net/header
<?php // there is contention over if this mime-type is right, but just use it for now header('Content-type: text/javascript'); header('Content-Disposition: attachment; filename="file.js"'); readfile('file.js'); // echo the file ?>
NOTE: this should be done before any other output (and can only be about the only one on the page if you do not want another output in your file).
In addition, there are a billion cheats on this issue in Stack Overflow. Too lazy to copy them all.
Dan Beam Jan 21 '10 at 3:29 2010-01-21 03:29
source share