.xls suffix on controller function to make excel file? |
[eluser]Unknown[/eluser]
I know you can take a HTML table and change the extension to .xls to make it pop up as an xls file but I am trying to utilize this with code igniter MVC. I have a form on one of my pages that takes the table from that page and dumps it into a function/view to put it out as a .xls page. my URL ends up being something like this. www.siteurl.com/index.php/report/excel but when I add .xls onto it I get a 404. It may be asking too much for CodeIgniter to accept www.siteurl.com/index.php/report/excel.xls instead of www.siteurl.com/index.php/report/excel.html If anyone has any ideas or solutions for this I could really use the help.
[eluser]Ivan A. Zenteno[/eluser]
Maybe if you try setting the headers, could be work.
[eluser]mr_prasanna[/eluser]
www.siteurl.com/index.php/report/index/excel.html You can probably try something like above and "excel.html" might be passed to index method inside your report controller. Also, you need to consider setting the Content-type header to something that triggers excel
[eluser]Unknown[/eluser]
Thanks for the direction on setting the MIME type I ended up using the PHP header() method like so Code: header('Content-type: application/vnd.ms-excel'); I don't have the .xls on the url but all I wanted was for the link to make an excel file out of the current document anyway. Thanks for the help!
[eluser]mr_prasanna[/eluser]
With a bit of .htaccess (ReWrite rule) you can get the .xls working too. |
Welcome Guest, Not a member yet? Register Sign In |