[thelist] Browser detection and save file as

Kevin Martin evolt at brasscannon.net
Tue Sep 18 10:53:46 CDT 2001

A client wished for an upload-download page; I borrowed some PHP code to 
invoke ftp, which worked fine for the upload but it fell over on the 
download side.  I hacked the PHP to present http links to the 
available files, so it works both ways now.  But...  it requires the 
user to be clueful enough to right-click (or whatever the equivalent is on 
a Mac!) in order to do a 'save file' or 'save link' or 'save this 
link as' depending on the browser she's using.

So... I was wondering if anyone had a clever trick that would force
all (or even most) browsers to download a file rather than opening a
file?  I have complete control over the server (Apache), if that helps.

Failing that, a pointer to some pre-tested code to detect the browser and 
platform would be a godsend -- few things shake a user's confidence worse 
than asking her to "right-click" with a Mac mouse.

<tip type="Warning!" author="digger">
IE 5 on MacOS 9.1 does NOT like self-signed OpenSSL certificates.
It will hang your Mac hard if you even try to view the site.  Be warned!

More information about the thelist mailing list