I'm using LaravelExcel and I want to load an Excel file on my project from a form, so I tried this:
use Maatwebsite\Excel\Facades\Excel;
public function postDocuments(Request $request)
{
try {
Excel::import($request->file('student_list'), function ($reader) {
foreach ($reader->toArray() as $row) {
dd($row);
}
});
} catch (\Exception $e) {
dd($e);
}
}
But I get this error when uploading:
pathinfo() expects parameter 1 to be string, object given
So what's going wrong here?
How can I solve this issue?
