There is a code
<?php require_once ('Classes/PHPExcel/IOFactory.php'); require_once ('main.php'); require_once ('PUT.php'); error_reporting(E_ALL ^ E_WARNING); ini_set('display_errors', '1'); date_default_timezone_set('Europe/Moscow'); $today = date("dmY"); $Excel = PHPExcel_IOFactory::load('temmp1.xlsx'); $Excel->setActiveSheetIndex(0); $aSheet = $Excel->getActiveSheet(); if (isset($_POST['savexcel'])){ header("Content-Type: text/html; charset=UTF-8"); header('Content-Type: application/vnd.openxmlformats-officedocument.spreadsheetml.sheet'); header('Content-Disposition: attachment;filename="simple.xlsx"'); header('Cache-Control: max-age=0'); // If you're serving to IE 9, then the following may be needed header('Cache-Control: max-age=1'); // If you're serving to IE over SSL, then the following may be needed header ('Expires: Mon, 26 Jul 1997 05:00:00 GMT'); // Date in the past header ('Last-Modified: '.gmdate('D, d MYH:i:s').' GMT'); // always modified header ('Cache-Control: cache, must-revalidate'); // HTTP/1.1 header ('Pragma: public'); // HTTP/1.0 $objWriter = PHPExcel_IOFactory::createWriter($Excel, 'Excel2007'); $objWriter->save('php://output'); exit; } else { some calculations and
$objWriter = PHPExcel_IOFactory::createWriter($Excel,'Excel2007'); $objWriter->save('simple.xlsx'); Every time an error is downloaded, the file “Error Не удается открыть файл "simple (96).xlsx", так как формат или расширение этого файла являются недопустимыми. Убедитесь, что файл не поврежден и расширение его имени соответствует его формату. Не удается открыть файл "simple (96).xlsx", так как формат или расширение этого файла являются недопустимыми. Убедитесь, что файл не поврежден и расширение его имени соответствует его формату.
What could be the error? I tried 10,000 options.
PKsignature. Perhaps the warning hit the output. - nick_n_aheader("Content-Type: text/html; charset=UTF-8");- delete / note - an extra line. Question - is the archive unpacked or not? If not, check that there were no beats, broken - we rule php. If yes - check for the validity of xml (which would open it), if valid - you will have to wool the structure then - but I think it will not come to that. - nick_n_a