Smit Saraiya Smit Saraiya - 8 months ago 42
PHP Question

excel file not downloading in proper format in php

I have use following code for download excel file.

$filename = "property.xls"; // File Name
// Download file
header("Content-Disposition: attachment; filename=\"$filename\"");
header("Content-Type: application/");

But, it will download blank excel file i need to download content of

I have place this code at top of page and during reloading of my page it will download excel file but it was empty every time.


As per last comment by @ravisachaniya i have removed <head> and <title> tag and all default content which comes when we create page, from current page and from connection page, Now it is works properly