1
0
mirror of https://github.com/immich-app/immich.git synced 2025-07-04 05:50:38 +02:00

Added limit on total of file upload on web

This commit is contained in:
Alex
2022-08-26 09:36:54 -07:00
parent 87f7b0849a
commit a128833e68
5 changed files with 31 additions and 14 deletions
web/src

@ -1,10 +1,13 @@
import {
notificationController,
NotificationType
} from './../components/shared-components/notification/notification';
/* @vite-ignore */
import * as exifr from 'exifr';
import { uploadAssetsStore } from '$lib/stores/upload';
import type { UploadAsset } from '../models/upload-asset';
import { api, AssetFileUploadResponseDto } from '@api';
import { albumUploadAssetStore } from '$lib/stores/album-upload-asset';
/**
* Determine if the upload is for album or for the user general backup
* @variant GENERAL - Upload assets to the server for general backup
@ -33,6 +36,15 @@ export const openFileUploadDialog = (uploadType: UploadType) => {
fileSelector.onchange = async (e: any) => {
const files = Array.from<File>(e.target.files);
if (files.length > 50) {
notificationController.show({
message: `Cannot upload more than 50 files at a time - you are uploading ${files.length} files`,
type: NotificationType.Error
});
return;
}
const acceptedFile = files.filter(
(e) => e.type.split('/')[0] === 'video' || e.type.split('/')[0] === 'image'
);