From 4acae3401d2b787dd1b0436dc5a6f4d71816fbae Mon Sep 17 00:00:00 2001 From: victorAnumudu Date: Wed, 26 Jun 2024 18:54:53 +0100 Subject: [PATCH] video upload file size increased to 30mb --- .env | 3 ++- .env.development | 4 +++- .env.production | 4 +++- src/components/MyActiveJobs/ActiveJobs.jsx | 14 +++++++++++++- src/components/MyActiveJobs/ActiveJobsMedia.jsx | 14 +++++++++++++- 5 files changed, 34 insertions(+), 5 deletions(-) diff --git a/.env b/.env index 7058ea5..cc38e78 100644 --- a/.env +++ b/.env @@ -72,7 +72,8 @@ REACT_APP_APPLE_SOCIAL_LOGIN=0 REACT_APP_LINKEDIN_SOCIAL_LOGIN=0 #File Handling -REACT_APP_MAX_FILE_SIZE=1000000 +REACT_APP_MAX_FILE_SIZE=1048576 +REACT_APP_MAX_VIDEO_FILE_SIZE=31457280 REACT_APP_TOTAL_NUM_FILE=4 #Auth Text(s) diff --git a/.env.development b/.env.development index 5ae253c..96c14b6 100644 --- a/.env.development +++ b/.env.development @@ -43,7 +43,9 @@ REACT_APP_GOOGLE_CLIENT_SECRET=aozK_2G8UjaCmLgPPkv9abIm REACT_APP_GOOGLE_CLIENT_SCOPE="https://www.googleapis.com/auth/plus.login https://www.googleapis.com/auth/userinfo.email https://www.googleapis.com/auth/userinfo.profile" REACT_APP_GOOGLE_REDIRECT_URL=http://localhost:9082/login/auth/ -REACT_APP_MAX_FILE_SIZE=1000000 +#File Handling +REACT_APP_MAX_FILE_SIZE=1048576 +REACT_APP_MAX_VIDEO_FILE_SIZE=31457280 REACT_APP_TOTAL_NUM_FILE=4 REACT_APP_LOGOUT_TEXT="Sign Out" diff --git a/.env.production b/.env.production index d0871a2..85c6cee 100644 --- a/.env.production +++ b/.env.production @@ -50,7 +50,9 @@ REACT_APP_FACEBOOK_REDIRECT_URL="https://users.wrenchboard.com/login/auth/flogin DISABLE_ESLINT_PLUGIN=true -REACT_APP_MAX_FILE_SIZE=1000000 +#File Handling +REACT_APP_MAX_FILE_SIZE=1048576 +REACT_APP_MAX_VIDEO_FILE_SIZE=31457280 REACT_APP_TOTAL_NUM_FILE=4 REACT_APP_LOGOUT_TEXT="Sign Out" diff --git a/src/components/MyActiveJobs/ActiveJobs.jsx b/src/components/MyActiveJobs/ActiveJobs.jsx index 8dc5852..5aad7b2 100644 --- a/src/components/MyActiveJobs/ActiveJobs.jsx +++ b/src/components/MyActiveJobs/ActiveJobs.jsx @@ -75,7 +75,19 @@ function ActiveJobs(props) { // IF NO FILE SELECTED RETURN return; } - if (files[0].size > Number(process.env.REACT_APP_MAX_FILE_SIZE)) { + let fileType = files[0].type.split('/')[0].toLowerCase() + if (fileType == 'video' && files[0].size > Number(process.env.REACT_APP_MAX_VIDEO_FILE_SIZE)) { // return if video file is more than 30mb + setRequestStatus({ + loading: false, + status: false, + message: "File must be <= 30mb", + }); + setTimeout(() => { + setRequestStatus({ loading: false, status: false, message: "" }); + }, 5000); + return; + } + if (files[0].size > Number(process.env.REACT_APP_MAX_FILE_SIZE)) { // return if other files is more than 1mb setRequestStatus({ loading: false, status: false, diff --git a/src/components/MyActiveJobs/ActiveJobsMedia.jsx b/src/components/MyActiveJobs/ActiveJobsMedia.jsx index 7ed7ee0..7584fcf 100644 --- a/src/components/MyActiveJobs/ActiveJobsMedia.jsx +++ b/src/components/MyActiveJobs/ActiveJobsMedia.jsx @@ -69,7 +69,19 @@ function ActiveJobsMedia(props) { // IF NO FILE SELECTED RETURN return; } - if (files[0].size > Number(process.env.REACT_APP_MAX_FILE_SIZE)) { + let fileType = files[0].type.split('/')[0].toLowerCase() + if (fileType == 'video' && files[0].size > Number(process.env.REACT_APP_MAX_VIDEO_FILE_SIZE)) { // return if video file is more than 30mb + setRequestStatus({ + loading: false, + status: false, + message: "File must be <= 30mb", + }); + setTimeout(() => { + setRequestStatus({ loading: false, status: false, message: "" }); + }, 5000); + return; + } + if (files[0].size > Number(process.env.REACT_APP_MAX_FILE_SIZE)) { // return if other files is more than 1mb setRequestStatus({ loading: false, status: false,