In this article i am going to explain how to download after form submitted in PHP.There are two ways available to download file using php.In this example i have used both methods.
1.Using PHP
2.Using Javascript and meta tag.
readfile() is used to Outputs a file.
Please share your comments and feedback.Thanks.Please subscribe my updates via email.
1.Using PHP
2.Using Javascript and meta tag.
readfile() is used to Outputs a file.
PHP Function
$file="test.zip";
header('Content-type: application/zip');
header('Content-Length: ' . filesize('test.zip'));
header("Content-Disposition: attachment; filename='test.zip'");
readfile($file);
header('Content-type: application/zip');
header('Content-Length: ' . filesize('test.zip'));
header("Content-Disposition: attachment; filename='test.zip'");
readfile($file);
Javascript function
<script>
$(document).ready(function(){
window.setTimeout(function(){
window.location = 'test.zip';
}, 1500);
});
</script>
$(document).ready(function(){
window.setTimeout(function(){
window.location = 'test.zip';
}, 1500);
});
</script>
wht abt diz
ReplyDeleteclick