Forum Moderators: open
This will only work for types that are NOT recognized by the browser. If it's a recognized type (html, jpg, etc.) it will just display. To to that you have to use server-side programming and "munge" the header. For example, let's say you want to force the DOWNLOAD a .gif file, which would normally display. So you print to the browser:
(Use some process to open the file and store it in memory - this is a perl snippet)
$fname = 'downloaded.gif';
open (FILE, $myfile);
$imagefile = <FILE>;
close (FILE);
print "content-type: bad/type\n";
print "Content-Disposition: attachment; filename=$fname\n\n"; #<-- populates file download dialog
print "$imagefile";
"Bad/Type" can be anything: ASfDedG - it just has to send to the browser an unrecognized MIME content-type header. That's what forces the file download.