diff --git a/src/components/DocumentOperation/DocumentOperation.tsx b/src/components/DocumentOperation/DocumentOperation.tsx
index 2e2d513..9fa3241 100644
--- a/src/components/DocumentOperation/DocumentOperation.tsx
+++ b/src/components/DocumentOperation/DocumentOperation.tsx
@@ -18,6 +18,7 @@ interface DocumentOperationProps {
onUploadSuccess?: () => void;
page?: string;
access?: string;
+ limitSize?: number;
}
const buildAcceptString = (extensions: string[]): string => {
@@ -44,6 +45,7 @@ export const DocumentOperation = ({
onUploadSuccess,
page = "",
access = "",
+ limitSize,
}: DocumentOperationProps) => {
const { openBackdrop, closeBackdrop } = useBackdropStore();
const showToast = useToast();
@@ -153,6 +155,11 @@ export const DocumentOperation = ({
fileInputRef.current.value = "";
}
+ if (limitSize && file.size > limitSize * 1024 * 1024) {
+ showToast(`حداکثر حجم فایل ${limitSize} مگابایت است`, "error");
+ return;
+ }
+
openBackdrop();
try {
const formData = new FormData();
@@ -212,7 +219,7 @@ export const DocumentOperation = ({
) : (
)}
- {uploadedFileName ? "آپلود شده" : "آپلود"}
+ آپلود