I am trying to get the file extension of the files from the multiple file input array.
I tried to use File::extension()
but it expects a string and I have an array.
I don't need this value for the validation so I can't use Laravel validation. Thanks
I am trying to get the file extension of the files from the multiple file input array.
Then loop over the $_FILES
array.
foreach ($_FILES as $key => $file) {
$extensions[$key] = \File::extension($file['name']);
}
The above presumes no fancy/opinionated $_FILES structure mutations ;p
The best way I use,
foreach ( $request->file ( 'attachment' ) as $attachment ) {
$orignalName = $attachment->getClientOriginalName ();
$mimeType = $attachment->getMimeType () ;
}
If you are using Laravel's default file upload.