Laravel-Excel: [BUG] Temp file is an Invalid Spreadsheet file error
Prerequisites
- Checked if your Laravel Excel version is still supported: https://docs.laravel-excel.com/3.1/getting-started/support.html#supported-versions
- Able to reproduce the behaviour outside of your code, the problem is isolated to Laravel Excel.
- Checked that your issue isn’t already filed.
- Checked if no PR was submitted that fixes this problem.
- Filled in the entire issue template
Versions
- PHP version: 7.3
- Laravel version: 7.12
- Package version: 3.1.19
Description
When importing a csv, this error is shown:
/private/var/tmp/laravel-excel-c7dP24qYpZ3MV15ecNHEfR3mD7FoaAxT is an Invalid Spreadsheet file.
Thrown by: /phpoffice/phpspreadsheet/src/PhpSpreadsheet/Reader/Csv.php:350
Steps to Reproduce
When I upload this Excel file: test.csv.zip
And execute this line of code:
Excel::toArray(new Import, request()->file('file'));
Expected behavior:
I receive an array, based on the CSV file.
Actual behavior:
An Exception was thrown:
/private/var/tmp/laravel-excel-c7dP24qYpZ3MV15ecNHEfR3mD7FoaAxT is an Invalid Spreadsheet file.
About this issue
- Original URL
- State: closed
- Created 4 years ago
- Comments: 17 (4 by maintainers)
Can you try setting a different temporary folder in the config/excel.php ?
@patrickbrouwers Awesome job mate thanks! I set the path to storage_path() and its worked perfectly! so must be permission issue with sys_get_temp_dir() directory! Thanks!