Home  >  Article  >  PHP Framework  >  Solve the problem of import error when using laravel-excel extension package (maatwebsite/excel) in Laravel

Solve the problem of import error when using laravel-excel extension package (maatwebsite/excel) in Laravel

藏色散人
藏色散人forward
2021-05-06 09:47:202463browse

The following tutorial column will introduce Laravel to you when using the laravel-excel extension package (maatwebsite/excel). I hope it will be helpful to friends who need it!

Solve the problem of import error when using laravel-excel extension package (maatwebsite/excel) in Laravel                                                                                                                

Message: The filename /tmp/laravel-excel-xxx is not recognized as an OLE file

Specific error message

  "_debug": {
            "position": "File: /wwwroot/www/api/v1/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Shared/OLERead.php, Line: 109",
            "error": "Code: 0, Message: The filename /tmp/laravel-excel-40eWbJlPwCeiJ1P40ESlH0nhA9wyjJlM is not recognised as an OLE file",...

Reason

User downloads the import template , but if you change the template extension, an error will be reported. If the template is in xlsx format and the user downloads it and changes it to xls format and then imports it, the error will be reported.

Solution

Allow users to fill in data strictly according to the template format and extension, and the file extension cannot be modified

The above is the detailed content of Solve the problem of import error when using laravel-excel extension package (maatwebsite/excel) in Laravel. For more information, please follow other related articles on the PHP Chinese website!

Statement:
This article is reproduced at:learnku.com. If there is any infringement, please contact admin@php.cn delete