This code is really useful to download files (i.e. an mp3 file). It will tell the browser about the file type you’re about to download while also customizing the file name of it:
header('Content-Disposition: attachment; filename="'.$name.'.mp3"');
Now we just need to provide the
$link variables for it to work.
This piece of code was borrowed from Michael Pardo. Thank you!