I am trying to import a csv file with Laravel 5.5 from the local file location. For some reason it can't find the file on my computer however the path is correct.
$fileLocation = $request->file('file')->store('csv');
$importFile = File::file(storage_path('app/' . $fileLocation));
You can use the Storage
facade for this. Here is an example:
if (Storage::disk($disk)->exists($filename)) {
return Storage::disk($disk)->get($filename);
}
throw new FileNotFoundException(sprintf('File not found: %s', $filename), 404);