Laravel-Excel: [BUG] Temp file is an Invalid Spreadsheet file error

Prerequisites

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)

Most upvoted comments

Can you try setting a different temporary folder in the config/excel.php ?

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!