Show error for files that are too large
This commit is contained in:
parent
0e0ab053f3
commit
e83b643d86
@ -1,8 +1,11 @@
|
||||
import { useReminder } from "./ReminderContext";
|
||||
import { useFlash } from "../App/FlashContext";
|
||||
|
||||
export const Attachment = () => {
|
||||
const [{ attachment_name }, setReminder] = useReminder();
|
||||
|
||||
const flash = useFlash();
|
||||
|
||||
return (
|
||||
<div class="file is-small is-boxed">
|
||||
<label class="file-label">
|
||||
@ -16,7 +19,8 @@ export const Attachment = () => {
|
||||
let file = input.files[0];
|
||||
|
||||
if (file.size >= 8 * 1024 * 1024) {
|
||||
return { error: "File too large." };
|
||||
flash({ message: "File too large (max. 8MB).", type: "error" });
|
||||
return;
|
||||
}
|
||||
|
||||
let attachment: string = await new Promise((resolve) => {
|
||||
|
Loading…
Reference in New Issue
Block a user