I'm using PHPExcel to generate a spreadsheet to download.
<?php
$objPHPExcel = new PHPExcel();
$emailReport = 'tmp/company.xls';
// Remove previous file if it exists.
$testdel=unlink($emailReport);
if(!$testdel){
echo "Unable to remove previous Spreadsheet<hr/>";
}
echo '<a href="'.$emailReport.'" class="dbutton">Download Spreadsheet</a><hr/>';
$objPHPExcel->getActiveSheet()->setCellValueByColumnAndRow(1, 1,'Old Value');
$objWriter = PHPExcel_IOFactory::createWriter($objPHPExcel, 'Excel5');
$objWriter->save($emailReport);
?>
All well and good.
The spreadsheet is created and it holds the text in cell A1.
But if I change the php file, perhaps by changing $objPHPExcel->getActiveSheet()->setCellValueByColumnAndRow(1, 1,'Old Value');
to $objPHPExcel->getActiveSheet()->setCellValueByColumnAndRow(1, 1,'New, Improved Value');
I'm expecting the new spreadsheet to contain "New, Improved Value" in cell A1, but when I click the link to download it, the version of the spreadsheet that is downloaded contains the old value.
Yet when I download the file using FTP, the file has indeed been updated.
Presumably the browser holds the file in cache?
How do I make sure that the correct version is downloaded?