我在阅读上传的文件时遇到问题
$fileElementName = 'file_to_import';
$ext = end(explode(".", $_FILES['file_to_import']['name']));
$filename = (rand(1000, 9999) . time()) . "." . $ext;
$save_to = "upload/" . $filename;
$msg .= " File Name: " . $_FILES['file_to_import']['name'] . ",";
$msg .= " File Size: " . @filesize($_FILES['file_to_import']['tmp_name']);
move_uploaded_file($_FILES["file_to_import"]["tmp_name"], $save_to);
@unlink($_FILES['file_to_import']);
require 'Excel_Reader.php';
$data = new Spreadsheet_Excel_Reader($save_to);
此处Excel_Reader.php
是一个使用Excel文件的库,但新Spreadsheet_Excel_Reader($save_to)
未打开文件并输出以下错误
文件名45061340615478.xls不可读