From ec85bc099bc00745320d19bc0c4693fc16d83b99 Mon Sep 17 00:00:00 2001 From: Prem Palanisamy Date: Thu, 2 Apr 2026 11:15:01 +0100 Subject: [PATCH] fix: show correct max file size in CSV import dialog The file picker was showing a hardcoded "10MB" limit which didn't reflect the actual upload limit. Now reads the plan-based fileSize limit on cloud and displays it dynamically using humanFileSize(). On self-hosted the size hint is hidden since the limit depends on server configuration. --- src/lib/components/filePicker.svelte | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/src/lib/components/filePicker.svelte b/src/lib/components/filePicker.svelte index 28b64406b..35ca470c2 100644 --- a/src/lib/components/filePicker.svelte +++ b/src/lib/components/filePicker.svelte @@ -9,7 +9,7 @@ import { Button, InputSelect } from '$lib/elements/forms'; import DualTimeView from './dualTimeView.svelte'; import type { Models } from '@appwrite.io/console'; - import { calculateSize } from '$lib/helpers/sizeConvertion'; + import { calculateSize, humanFileSize, sizeToBytes } from '$lib/helpers/sizeConvertion'; import InputSearch from '$lib/elements/forms/inputSearch.svelte'; import { ID, Query, Permission, Role } from '@appwrite.io/console'; import { @@ -34,6 +34,8 @@ import { showCreateBucket } from '$routes/(console)/project-[region]-[project]/storage/+page.svelte'; import { preferences } from '$lib/stores/preferences'; import { addNotification } from '$lib/stores/notifications'; + import { isCloud } from '$lib/system'; + import { currentPlan } from '$lib/stores/organization'; export let show: boolean; export let mimeTypeQuery: string = 'image/'; @@ -53,6 +55,10 @@ let fileSelector: HTMLInputElement; let uploading = false; let view: 'grid' | 'list' = 'list'; + $: planMaxSize = + isCloud && $currentPlan?.['fileSize'] + ? sizeToBytes($currentPlan['fileSize'], 'MB', 1000) + : null; onMount(() => { const lastSelectedBucket = preferences.getKey('lastSelectedBucket', null); @@ -381,8 +387,12 @@ : `${allowedExtension} files are allowed`} - Max file size: 10MB + {#if planMaxSize} + {@const readableMaxSize = humanFileSize(planMaxSize)} + Max file size: {readableMaxSize.value + + readableMaxSize.unit} + {/if}