Roger Travis
Roger Travis

Reputation: 8538

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 that 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.

Upvotes: 0

Views: 1560

Answers (2)

Roger Travis
Roger Travis

Reputation: 8538

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;
?>

Upvotes: 0

Pekka
Pekka

Reputation: 449515

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.

Upvotes: 3

Related Questions