javascript - Reload parent page(redirect to another page) after downloading file -
i have script wav files download:
down.php:
<?php if (isset($_get['file'])) { $file = $_get['file'] ; if (file_exists($file) && is_readable($file) && preg_match('/\.wav$/',$file)) { $filename = basename($file); header('content-type: application/wav'); header("content-disposition: attachment; filename=".$filename); readfile($file); } } else { header("http/1.0 404 not found"); echo "<h1>error 404: file not found: <br /><em>$file</em></h1>"; } ?>
so when click on hyperlink in mypage.php:
<a href=<?php echo "down.php?file=full_file_path"?>><?php echo "file_name"?></a>
a file gets downloaded!
how can reload mypage.php after download dialog box gets closed, when file gets downloaded?
i've tried few things none of worked. like, redirection after readfile(), found out it's impossible output header after have output file. calling javascript function on onclick event reload location. opening down.php?file=full_file_path
first , reloading location. , more ...
any idea , how it?
Comments
Post a Comment