我知道大多数研究建议以csv格式上传更容易。由于用户的要求,我需要将xls格式的excel上传到数据库中,是否可以在cake php中进行操作?或使用其他方法将xls文件转换为csv文件然后只上传? 谢谢!
我试过这个......它显示了未定义的变量:ext和undefined index:Upload
$destination = realpath('../../app/webroot/uploads/excel/' . '/');
if(isset($_FILES['Upload']['XLS_File']))
$ext = substr($_FILES['Upload']['XLS_File'], strrpos($_FILES['Upload']['XLS_File'], '.') + 1);
$path = $destination.'excel'.$ext;
move_uploaded_file($_FILES['Upload']['tmp_name'], $path);
$data = new Spreadsheet_Excel_Reader($path, true);
$temp = $data->dumptoarray();
if($temp)
{
foreach ($temp as $key=>$val)
{
$val['0'];
}
}
}