If a user clicks on a file to download, I want the browser to display the contents if it can (PDFs, images) otherwise download it. For PDFs and images, if they choose to download the file, I want the proper file name to be in the dialog box. My code is:
header("Content-type: $mime");
header("Content-Disposition: attachment; filename=\"$name\"");
//send the file contents to the browser
This causes the file to be downloaded all the time. Are there additional header parameters I need to pass?