mirror of
https://github.com/pacnpal/thrilltrack-explorer.git
synced 2025-12-23 09:11:13 -05:00
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
This commit is contained in:
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user