Link to home
Start Free TrialLog in
Avatar of um3814
um3814

asked on

how to set the filename for data that is sent to the browser for downloading

I use a perl cgi script to limit access to files to authorized users only. I send the files with content-type application/octet-stream so that they will be offered for saving to disk. Unfortunately the filename that the browser is proposing is derived from the cgi scriptname. How can I set that filename in the cgi script ?
ASKER CERTIFIED SOLUTION
Avatar of mouatts
mouatts

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of um3814
um3814

ASKER

I already supposed that it would be a tricky thing. I'm using Unix and I already know the method with symbolic links. As i cannot predict the name of the file, a solution is , to create the link and send a reload command for that link and then remove the link. But the link name must have the same name as the file
( incl. extension) and the extension will confuse the browser.
The content-type is not always the main criteria.
From all you said I learned , that the key point is to make the browser send an URL with the name of the file.