diff --git a/src/components/inputtag/ImageUpload.tsx b/src/components/inputtag/ImageUpload.tsx index 74a8eec..f24941e 100644 --- a/src/components/inputtag/ImageUpload.tsx +++ b/src/components/inputtag/ImageUpload.tsx @@ -3,6 +3,7 @@ import Image from 'next/image'; import React, { MutableRefObject, useRef } from 'react'; import { FiUpload } from 'react-icons/fi'; import { RiDeleteBin5Fill } from 'react-icons/ri'; +import { toast } from 'react-toastify'; import { fileToBase64Image } from '@/lib/helper'; @@ -28,6 +29,10 @@ const ImageUpload = ({ }; async function readImage(file: File) { + if (file.size > 5 * 1024 * 1024) { + toast.error('Maximum file size exceeded (5 MB)'); + return; + } onChange(file); fileToBase64Image(file, handleImage); }