0

I have the following code for download the contents in excel using phpexcel. When I download the file,its showing a virus warning alert.If I tried to click the accept the risk button ,it will download the contents. I have removed the data from excel in order to check if its because of data .But still there is no change. I have added many headers in the script ,still no change.Please help me.

enter image description here

My php code is as follows:

 session_start();
 require '../config/config.php';
 $db = new Database();
 $conn = $db->connect();
 require_once '../../PHPExcel/Classes/PHPExcel.php'; 
 $objPHPExcel = new PHPExcel();
 $objPHPExcel->setActiveSheetIndex(0);
 header('Content-Type: application/vnd.ms-excel; charset=utf-8');
 header('Content-Disposition: attachment; filename="excelreport.xls"');   
 header('Cache-Control: max-age=0');  
 $objWriter = PHPExcel_IOFactory::createWriter($objPHPExcel, 'Excel5');
 //ob_end_clean();
 $objWriter->save('php://output'); 
 ob_clean();
Techy
  • 2,626
  • 7
  • 41
  • 88
  • Did you try to upload the resulting file to an online virus scanner? I don't know if this is a warnung by the browser or by your installed anti virus software. If it's the first - did you try another browser? Otherwise you could upload the resulting file to the software company and flag it as false positive. – TimSch Nov 17 '18 at 15:11
  • I didn't check with virus scanner..for my clients computer,its showing as virus file and could not even download it .he has anti virus installed.. How to make flag as false positive – Techy Nov 17 '18 at 15:13
  • You could do this - just for fun (or to be sure, you never know). At the same time you could, like already mentioned, upload it as "false positive" to the developers of the software which flagged this file as dangerous. In my experience they respond quickly and if it's a false positive they should update their signatures. – TimSch Nov 17 '18 at 15:17
  • ok..lemme try..I am not sure why is then showing in google chrome also – Techy Nov 17 '18 at 15:30
  • That's suspect indeed. Then you should really investigate this. The other possibility would be that your server or maybe your copy of phpexcel is somehow infected. This could cause the injection of malware into the downloads. These are my two ideas which I could think of. The last one may seem a bit paranoid though. – TimSch Nov 17 '18 at 15:32
  • Ok..I will check the phpexcel folder again – Techy Nov 17 '18 at 15:38

0 Answers0