Force file Download

Provide files to the user by forcing them to download.

    *@file - physical path to file on server
    *@$filename4User - New file which will
    *    use as new name for downloaded file
    function force_download($file, $filename4User)
        if ((isset($file))&&(file_exists($file))) {
           header("Content-length: ".filesize($file));
           header('Content-Type: application/octet-stream');
           header('Content-Disposition: attachment; filename="' . $filename4User. '"');
        } else {
           echo "No file selected";

Read previous post:
Usage of PHP Magic Constants

__LINE__ The current line number of the file. __FILE__ The full path and filename of the file. If used inside...