Image validation does not work with yup validate
P粉738821035
P粉738821035 2024-03-30 16:09:36
0
1
431

I'm trying to use yup for verification. Required does not apply to images.

image: yup.string().required("required"),

I am using formik as required fields. This works for every field of form, but not for images. I have initialized the initial value:

const initialValues = {
   image: "",
};

P粉738821035
P粉738821035

reply all(1)
P粉741223880

Use this yup verification for file upload

attachment: Yup.mixed()
.test(
  'FILE_SIZE',
  'File is required',
  value => value && value.size >= 10,
)
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!