We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
2 parents 4998162 + ada5b1a commit c247a41Copy full SHA for c247a41
src/Fields/FileField.php
@@ -31,7 +31,10 @@ public function __construct(array $args = array())
31
32
public function validate($value)
33
{
34
- if (0 == $value->size && $this->required) {
+ if (is_null($value) && !$this->required) {
35
+ return;
36
+ }
37
+ if (is_null($value) && $this->required || 0 == $value->size && $this->required) {
38
throw new ValidationError($this->error_messages['required'], 'required');
39
}
40
@@ -51,6 +54,9 @@ public function validate($value)
51
54
52
55
public function toNative($value)
53
56
57
+ if (is_null($value)) {
58
+ return null;
59
60
if (!is_array($value)) {
61
throw new ValidationError(msg("INVALID_FILE"), 'invalid');
62
0 commit comments