0
我做了一個html表單來將excel表導入到mysql中。從窗體加載後,文件以.tmp擴展名存儲在內存中。我如何使用phpexcel解析這個.tmp文件?或者是否有更好的方法來從HTML表單加載它並直接解析? 我的代碼;使用PHPExcel解析excel file.tmp
<form action='load.php' method="POST" enctype="multipart/form-data">
<p><input type="file" name='excelfile'/></p>
<p><button type="button">upload</button></p>
</form>
//load.php
<?php
if (!empty($_FILES["excelfile"])) {
if ($excel["error"] !== UPLOAD_ERR_OK) {
echo "<p>An error occurred.</p>";
exit;
}
else {
echo "File uploaded";
require '../class/PHPExcel.php';
require_once '../class/PHPExcel/IOFactory.php';
$path = ????; //....how to parse this file, now stored as filename.tmp
$objPHPExcel = PHPExcel_IOFactory::load($path);
//........
}
}
?>
感謝@jd namera,但爲什麼我不斷收到此錯誤「致命錯誤:用C超過最長30秒的執行時間:\ WAMP \ www ..「 – ArchieTiger
set_time_limit(0)有效! – ArchieTiger