O
O
opensuse20082021-05-29 18:30:43
Laravel
opensuse2008, 2021-05-29 18:30:43

How in Laravel to provide a downloadable file (store) to the FastExcel library?

The following task appeared - to load xlsx-files into laravel and get data from them.
To open xlsx files I use the FastExcel library . It has a method - import, which needs to specify the path to the file.
I made a file download page and using the store method, I save it to the storage. The file is eventually saved to this directory - LARAVEL\storage\app.
By default, when accessing files in laravel, the LARAVEL\public\ directory is accessed.
As a result, to specify the path to the file, I specify the path like this: ..\storage\app\file.xlsx.
It seems to me that this is not correct, tell me how to do it better?
LARAVEL also has the Storage::get('file.xlsx') method, but as I understand it, it returns binary data, and the import method of the FastExcel library needs exactly the path to the file.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Alexander, 2021-05-29
@zkelo

Try the method Storage::path()- it returns the absolute path to the file
Documentation

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question