Your code sample works great but it forces the "Save As.." dialogue to pop up in IE 5.5 under all circumstances even if the browser knows how to display a file. It also displays the name of the php file ("download.php") rather than the name of the file itself.
What I am try to do is allow users with different access levels access to different files. So say there are two access levels - user and admin.
Users with user access will have access to the "c:\user" dir and users with admin access will have access to the "c:\admin" dir.
While downloading the file I'm trying to accomplish a few things:
1) I want to hide the actual location of the file ("c:\user" or "c:\admin") so the user has no idea where the file is being stored on the server. NOTE: The file will not be stored in htdocs dir or a sub dir of for the same reason php inc files are not included there.
2) Files that the browsers recognizes should be dealt with appropriately (jpegs, gifs, etc.) and other files should prompt the user with an option box asking them how to deal with the file (ie. "Save As.." or "Open With..")
3) When the "Save As.." option appears the filename of the file to be saved is correct sans path rather than say download.php. So rather than "You have chosen to download... download.php from localhost" I would like to display "You have chosen to download... "filename.ext" from localhost"
where "filename.ext" is the correct filename.
I'm really stumped here. I've tried countless combinitions acheiving each goal individually but never acheiving all at the same time.
Thanks,
Brian