I'm confused
You say cannot find the file
then you say you can see the file and its in storage/app/public/csvs
I am using Spatie Simple Excel but it cannot find the file that I am passing to it. Here is my controller
$path = $request->file('file')->storeAs('public/csvs', 'contacts.csv');
// $rows is an instance of Illuminate\Support\LazyCollection
$rows = SimpleExcelReader::create($path, 'csv')->getRows();
$rows->each(function (array $rowProperties) {
dd($rowProperties);
// in the first pass $rowProperties will contain
// ['email' => '[email protected]', 'first_name' => 'john']
});
if I DD out $path I get public/csvs/contacts.csv and if I look in my local folders I can see the file is there.. well its actually in public/storage/csvs/contacts.csv but I think thats just how laravel works.
Any ideas?
I assume SimpleExcelReader needs the full path so just prefix with storage_path
$rows = SimpleExcelReader::create(storage_path('app/') . $path, 'csv')->getRows();
Please or to participate in this conversation.