Hello I have added download sample file link in my project. This is what I done for that:-
<a href="<?php echo HTTP_PATH; ?>sample_user_invitation.csv" style="color:#00f">Download Sample File</a>
Note:HTTP_PATH is constant for define file path
It seems to work fine in all browser but not working in IE-8.In iE-8 when I try to download it shows all contain of file in browser. any suggestion will appreciate.
It's better to create another page with correct meta-tag to help browser managing file as a download one.
Your code does not order to download a file but ask any single browser to perform their own default action with "csv" file. IE 8 lacks in this feature.
So any download link must to call a php function that sets the page with this headers:
header('Content-type: text/csv');
header('Content-Disposition: attachment; filename="' .$HTTP_PATH. $fileName. '"');
if you need a tutorial, look here
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.