add client-side file size validation before upload
This commit is contained in:
parent
4c5ded4c52
commit
c998227fec
1 changed files with 8 additions and 0 deletions
|
|
@ -357,6 +357,14 @@ export function DatasetSection() {
|
|||
event.target.value = "";
|
||||
if (!file) return;
|
||||
|
||||
const MAX_SIZE_BYTES = 512 * 1024 * 1024;
|
||||
if (file.size > MAX_SIZE_BYTES) {
|
||||
toast.error("File too large", {
|
||||
description: "Maximum upload size is 512 MB.",
|
||||
});
|
||||
return;
|
||||
}
|
||||
|
||||
setIsUploading(true);
|
||||
try {
|
||||
const contentBase64 = await fileToBase64Payload(file);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue