Question
Validating file presence with YUP
I'm using Yup to validate my form. In one of my form, I want to validate that one <input type="file" />
has a file.
I've tested this (and it's not working):
Yup.object().shape({
file: Yup.object().shape({
name: Yup.string().required()
}).required('File required')
I've the following error message in the console:
file must be a
object
type, but the final value was:null
(cast from the value{}
). If "null" is intended as an empty value be sure to mark the schema as.nullable()
Any idea?
46 85309
46