ngControl
with a value of new Control('', Validators.required)
didn't work even when the file is valid.
(and actually, I found it difficult to validate radio buttons as well...)
The uploader component validate the selected files extension and size using the allowedExtentions , minFileSize and maxFileSize properties. The files can be validated before uploading to the server and can be ignored on uploading.
Check File Size before Uploading it in Angular Uploader component. By using uploading event, you can get the file size before upload it to server. File object contains the file size in bytes only. You can convert the size to standard formats ( KB or MB ) using bytesToSize method.
Form validation is a “technical process where a web-form checks if the information provided by a user is correct.” The form will either alert the user that they messed up and need to fix something to proceed, or the form will be validated and the user will be able to continue with their registration process.
Validators.required
depends on the value of the field.
Input type file
does not have a value, therefore is considered as undefined
or null
.
That is why it is invalid. Better write you own validation.
For custom file validation example refer
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With