forked from brandonsavage/Upload
-
Notifications
You must be signed in to change notification settings - Fork 3
Open
Labels
bugSomething isn't workingSomething isn't working
Description
I found this bug
When allowing multiple files to be uploaded via a single file input field, if one of those files fails the validation check any subsequent files will not be processed.
This is Upload and PHP version and environment (server/fpm/cli etc) I am using
Upload 2.0.0 and PHP7.4
This is the HTML/CSS code snippet I use for the form
<form method="POST" enctype="multipart/form-data">
<input type="file" name="foo[]" value="" multiple/>
<input type="submit" name="submit" value="Upload File"/>
</form>This is the PHP code snippet I use after form submission
<?php
require __DIR__ . '/vendor/autoload.php';
if (isset($_POST['submit'])) {
$storage = new \GravityPdf\Upload\Storage\FileSystem(__DIR__ . '/upload/');
$file = new \GravityPdf\Upload\File('foo', $storage);
$file->addValidations([
new \GravityPdf\Upload\Validation\Mimetype('image/png'),
new \GravityPdf\Upload\Validation\Extension('png'),
new \GravityPdf\Upload\Validation\Size('5M'),
]);
try {
// Success!
$file->upload();
} catch (\Exception $e) {
// Fail!
print_r($file->getErrors());
}
}
?>Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't working