8.4.2: how to validate multiple uploading files

Permalink
I have a number of Select File widgets on a page:
echo $form->file('file[]', ['accept' => ".jpg, .jpeg, .png"]);

I get the files array with:
$files = $this->request->files;

And I need to validate each of them. I can't figure out how I get each of them from the array. If I had only one file, I'd get it as:
$f = $files->get('file');

How do I get them in a loop for validation?

linuxoid
 
linuxoid replied on at Permalink Reply
linuxoid
I got it:
$files = $files->get('file');
foreach ($files as $file) {
    if (is_object($file)) {
        $file_name = mb_strtolower($file->getClientOriginalName());
    }
}