0

i have generated a xls file in a Cordova App Using PHP and i want to download it. It is perfectly working in Android , In the case of ios the file is opening on the browser But not downloading.

Here my code is.

 <?php
 $output .= '"S.No","Invoice No","Invoice Date"'."\n";
 $output .= '"S.No","Invoice No","Invoice Date"'."\n";
 $output .= '"S.No","Invoice No","Invoice Date"'."\n";
 $output .="\n";
 $date=date('d-m-Y H:i:s');
 $filename =  "report".$date.".csv";
 header('Content-type: application/xls');
 header('Content-Disposition: attachment; filename='.$filename);
 echo $output;
 exit;
 ?>
CBroe
  • 91,630
  • 14
  • 92
  • 150
  • 2
    Try `Content-Type: application/octet-stream`, instead of a content type the browser might think it should handle itself. https://stackoverflow.com/a/7263943/1427878 – CBroe May 25 '21 at 08:05
  • `Content-Type: application/octet-stream` not working – barath tamil May 27 '21 at 10:14

0 Answers0