读取上传的文件时出现问题
$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 不可读