From 65546141bb7104053f4f35617560200c3f63d36a Mon Sep 17 00:00:00 2001 From: pac7 <47831526-pac7@users.noreply.replit.com> Date: Sat, 4 Oct 2025 14:23:39 +0000 Subject: [PATCH] Improve photo upload by preventing empty uploads Add a check to prevent an upload if no files are selected, displaying an error message. Replit-Commit-Author: Agent Replit-Commit-Session-Id: f44f1d1b-1dd8-407b-8603-db12902e1a15 Replit-Commit-Checkpoint-Type: intermediate_checkpoint --- src/components/upload/PhotoUpload.tsx | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/components/upload/PhotoUpload.tsx b/src/components/upload/PhotoUpload.tsx index db3e6584..786afc6c 100644 --- a/src/components/upload/PhotoUpload.tsx +++ b/src/components/upload/PhotoUpload.tsx @@ -165,6 +165,12 @@ export function PhotoUpload({ const filesToUpload = isAvatar ? Array.from(files).slice(0, 1) : Array.from(files).slice(0, actualMaxFiles - totalImages); + if (filesToUpload.length === 0) { + setError('No files to upload'); + onError?.('No files to upload'); + return; + } + // Validate all files first for (const file of filesToUpload) { const validationError = validateFile(file);