开发者

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;
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜