Skip to content

Commit

Permalink
added job logo image file check (#506)
Browse files Browse the repository at this point in the history
  • Loading branch information
devsharmagit authored Oct 16, 2024
1 parent 0061739 commit 0304925
Showing 1 changed file with 10 additions and 3 deletions.
13 changes: 10 additions & 3 deletions src/components/job-form.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -128,12 +128,19 @@ const PostJobForm = () => {
}
};

const handleFileChange = async (e: any) => {
const selectedFile = e.target.files[0];
const handleFileChange = async (e: React.ChangeEvent<HTMLInputElement>) => {
const selectedFile = e.target.files ? e.target.files[0] : null;
if (!selectedFile) {
return;
}

if (!selectedFile.type.includes('image')) {
toast({
title:
'Invalid file format. Please upload an image file (e.g., .png, .jpg, .jpeg, .svg ) for the company logo',
variant: 'destructive',
});
return;
}
const reader = new FileReader();
reader.onload = () => {
if (companyLogoImg.current) {
Expand Down

0 comments on commit 0304925

Please sign in to comment.