diff --git a/src/Components/CustomFields/ImageBoxField/ImageBoxField.tsx b/src/Components/CustomFields/ImageBoxField/ImageBoxField.tsx index 65ef83e..89888fc 100644 --- a/src/Components/CustomFields/ImageBoxField/ImageBoxField.tsx +++ b/src/Components/CustomFields/ImageBoxField/ImageBoxField.tsx @@ -27,6 +27,7 @@ const ImageBoxField = ({ name }: any) => { const handleFileChange = (event: any) => { const file = event.target.files[0]; + if (file) { const maxSize = 2 * 1024 * 1024; @@ -42,6 +43,8 @@ const ImageBoxField = ({ name }: any) => { if (file) { generateImagePreview(file, setImagePreview); + console.log(file,"file"); + formik.setFieldValue(name, file); } }; @@ -55,7 +58,7 @@ const ImageBoxField = ({ name }: any) => { const handleCancel = () => { setImagePreview(""); - formik.setFieldValue(name, ""); + formik.setFieldValue(name, null); if (fileInputRef.current) { fileInputRef.current.value = ""; @@ -79,9 +82,9 @@ const ImageBoxField = ({ name }: any) => {