From e5bc6291167ed1ea71d7bfc23518d965c9636338 Mon Sep 17 00:00:00 2001 From: Kamil Date: Fri, 9 Aug 2024 11:36:32 +0200 Subject: [PATCH] #66 - fix: code review fix 2 --- environment/dev/app/php.ini | 2 ++ resources/js/Pages/Dashboard/Setting/Edit.vue | 18 +++++++++++++----- 2 files changed, 15 insertions(+), 5 deletions(-) diff --git a/environment/dev/app/php.ini b/environment/dev/app/php.ini index 8ffeea5..a518026 100644 --- a/environment/dev/app/php.ini +++ b/environment/dev/app/php.ini @@ -1,5 +1,7 @@ [PHP] memory_limit = 256M +upload_max_filesize = 40m +post_max_size = 50m [xdebug] xdebug.client_host=xdebug://gateway diff --git a/resources/js/Pages/Dashboard/Setting/Edit.vue b/resources/js/Pages/Dashboard/Setting/Edit.vue index f235f02..f06783d 100644 --- a/resources/js/Pages/Dashboard/Setting/Edit.vue +++ b/resources/js/Pages/Dashboard/Setting/Edit.vue @@ -25,7 +25,7 @@ const form = useForm({ department_name: props.settings.department_name, primary_color: props.settings.primary_color, secondary_color: props.settings.secondary_color, - logo: props.settings.logo, + logo: null, }) const imageUrl = ref('') @@ -35,7 +35,15 @@ function updateSettings() { } function onFileSelected(event) { - form.logo = event.target?.files[0] + const file = event.target?.files[0] + + if(file.size > 1024 * 1024) { + form.errors.logo = 'Plik nie może być większy niż 1MB' + + return + } + + form.logo = file imageUrl.value = URL.createObjectURL(event.target?.files[0]) form.errors.logo = '' } @@ -116,8 +124,8 @@ function onFileSelected(event) { > - -
+ +
Aktualne logo