dimanche 23 décembre 2018

how to move multiple file in laravel

i want to move multiple file using laravel, here what i try

foreach ($request->file as $allfiles){
            $songname = time().'.'.$allfiles->getClientOriginalExtension();
            $allfiles->move(public_path('samplesong'), $songname);
            $input['id_single'] = $single->id;
            $input['title_song'] = 'Title Song';
            $input['file_sample_song'] = $songname;
            $artist = RelationSingleSampleSong::create($input);
        }

code above just move 2 files from 4 files that i choose.

in database all files inserted successfully.



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire