Función PHP para forzar la descarga de archivos

El título lo dice todo: function force_download($file) { if ((isset($file)) && (file_exists($file))) { header(“Content-length: “.filesize($file)); header(‘Content-Type: application/octet-stream’); header(‘Content-Disposition: attachment; filename=”‘ . $file . ‘”‘); readfile(“$file”); } else  { echo “No se ha seleccionado ningún fichero”; } } FUENTE: 21 Really Useful & Handy PHP Code Snippets