Merge pull request #168 from Hexastack/145-issue-missing-content-file-upload-input

fix: add content file upload input
This commit is contained in:
Med Marrouchi
2024-10-09 08:59:30 +01:00
committed by GitHub
7 changed files with 146 additions and 3 deletions

View File

@@ -99,6 +99,17 @@ const AttachmentUploader: FC<FileUploadProps> = ({
const file = event.target.files.item(0);
if (file) {
const acceptedTypes = accept.split(',');
const isValidType = acceptedTypes.some((type) =>
file.type === type || file.name.endsWith(type.replace('.*', ''))
);
if (!isValidType) {
toast.error(t("message.invalid_file_type"));
return;
}
uploadAttachment(file);
}
}