Hello I'm trying to upload csv file and in instant next step move that data to database, but it's causing file not found exception. please guide me where m i wrong. here is my existing code
public function upload(Request $request) {
$path = $request->file('file')->storeAs('csv', 'sample.csv');
Storage::setVisibility($path, 'public');
Excel::filter('chunk')->load(storage_path($path))->chunk(250, function($results) {
foreach ($results as $row) {
User::create([
'username' => $row->username,
'contact' => $row->contact
]);
}
});
}
via Chebli Mohamed
Aucun commentaire:
Enregistrer un commentaire