how to make a file download then user open index.html?
What I need is when user open, foe example, www.mydomain.com/install , he would be offered to download a file.
I made an index file in th开发者_如何学Cat folder with
<META HTTP-EQUIV="Refresh" CONTENT="0;URL=myfile.sis">
but on some devices instead of downloading, it would attempt to open and display the file in that strange hex(?) format.
any idea... thanks!
P.S.
<?php
header("Location: skyeye.sis");
exit;
?>
does the same.
You will need to send the right headers that force the browser to treat the file as a download.
You use PHP. This question gives one option. It would mean that you would have a PHP script be requested, and serve the SIS file.
If you use Apache, this should also be possible in a .htaccess
file telling the web server to serve the right headers for the .sis
file type - this would be less straining on the resources, as it is not handled by PHP.
Thanks, looked up the header and it works!
<?php
header('Content-type: application/sis');
header('Content-Disposition: attachment; filename="sss.sis"');
readfile('sss.sis');
exit;
?>
精彩评论