diff --git a/src/components/company-form.tsx b/src/components/company-form.tsx index 39772a80..470724e4 100644 --- a/src/components/company-form.tsx +++ b/src/components/company-form.tsx @@ -76,7 +76,7 @@ export const CompanyForm = ({ setIsDialogOpen }: any) => { }; const handleFileChange = async (e: any) => { - const selectedFile = e.target.files[0]; + const selectedFile = e.target.files?.[0]; if (!selectedFile) return; // Basic file validation @@ -88,6 +88,8 @@ export const CompanyForm = ({ setIsDialogOpen }: any) => { }); } + setFile(selectedFile); + const reader = new FileReader(); reader.onload = () => { if (companyLogoImg.current) { @@ -95,8 +97,8 @@ export const CompanyForm = ({ setIsDialogOpen }: any) => { } setPreviewImg(reader.result as string); }; + reader.readAsDataURL(selectedFile); - setFile(selectedFile); }; const handleDescriptionChange = (fieldName: any, value: string) => { diff --git a/src/components/job-form.tsx b/src/components/job-form.tsx index c80a24af..8dd2e358 100644 --- a/src/components/job-form.tsx +++ b/src/components/job-form.tsx @@ -626,22 +626,35 @@ const PostJobForm = () => {