Reading spreadsheet using PHPExcel

前端 未结 2 1986
囚心锁ツ
囚心锁ツ 2021-02-08 19:34

I\'m trying to upload a spreadsheet and read it into a MySQL database using PHPExcel.

For .xlsx files it works fine but whenever I try to upload a .ods file it throws th

2条回答
  •  不思量自难忘°
    2021-02-08 20:06

    In my case there was an error detecting the extension in this line

    $extension = strtoupper(pathinfo($inputFile, PATHINFO_EXTENSION));
    

    if you need to solve just check from the name parameter

    $extension = strtoupper(explode(".", $_FILES['spreadsheet']['name'])[1]);
    

    The rest is working thanks :)

提交回复
热议问题