i have a website which i sell my books on, now i want to redirect my users to the home page (index.html) when they click the download link and the file starts to download.
Will really appreciate the help and support thanks.
this is the php code i wrote
<?php
$fakeFileName= "e-book_mobi.mobi";
$realFileName = "e-book_mobi.mobi";
$file = "book/". $realFileName;
$fp = fopen($file, 'rb');
header("Content-Type: application/octet-stream");
header("Content-Disposition: attachment; filename=$fakeFileName");
header("Content-Length: " . filesize($file));
fpassthru($fp);
exit;
?>
this is the download link
<li><a href="mobi_download.php?id=<?php echo $_GET['id']; ?>" target="_blank"/><b>.mobi</b></a></li>