I am fetching data from database and export it into excel file using phpexcel5. that is working fine but i don't want to save this excel file into my server folder. I am using unlink function for delete this excel file but it is not working .
Below is my code -
header('Content-type: application/ms-excel');
header("Content-Disposition: attachment; filename=\"" . $filename . "\"");
header("Cache-control: private");
$objWriter = PHPExcel_IOFactory::createWriter($this->excel, 'Excel5');
$objWriter->save("export/$filename");
header("location: " . base_url() . "export/$filename");
unlink(base_url() . "export/$filename");
export is my folder name where excel file will be stored. I want to delete this excel file from export folder.