ms excel文件无法在PHPExcel中加载,但是当我在linux中使用libreoffice创建excelsheets时,它会加载并上传到数据库中。
$temp=$_FILES['file']['tmp_name'];
$destination = "/var/www/html/recovery";
move_uploaded_file($temp,$destination."/"."recovery"."."."xlsx");
chmod("/var/www/html/recovery/recovery.xlsx", 0777);
$inputFileName ='recovery.xlsx';
try
{
$inputFileType = PHPExcel_IOFactory::identify($inputFileName);
$objReader = PHPExcel_IOFactory::createReader($inputFileType);
$objPHPExcel =$objReader->load($inputFileName);
}
catch(Exception $e)
{
die('Error loading file "'.pathinfo($inputFileName,PATHINFO_BASENAME).'": '.$e->getMessage());
}
$allDataInSheet = $objPHPExcel->getActiveSheet()- >toArray(null,true,true,true);
$arrayCount = count($allDataInSheet);
我使用PHPExcel上传所有类型的excel文件。