how to give save option to a xls file
I need to generate a report form mysql table in xls format. I got
Saving a .xls file with fwrite
this code and it is working like charm. But the thing is I need to have a save option, download and browse the dir开发者_JS百科ectory to save the file. Can anybody helpme out? I tried changing the header but i didn't get any success.
Thanks in advance
Vinay
Assuming you're using PHP:
header('Content-Type: application/vnd.ms-excel;');
header('Content-type: application/x-msexcel');
header('Content-Disposition: attachment; filename="your_xls_on_the_server.xls";');
header("Content-Transfer-Encoding: binary");
header("Content-Length: " . filesize('your_xls_on_the_server.xls'));
ob_clean();
flush();
readfile('your_xls_on_the_server.xls');
exit;
精彩评论