Last active
July 19, 2022 07:46
-
-
Save Octagon-simon/09c72a940e9ac943038dda7af4787254 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| //convert 2mb to bytes | |
| const requiredSize = 1024 * 1024 * 2; | |
| //save file size | |
| let filesSize = 0; | |
| //loop through object | |
| for (let file of fileInpFiles){ | |
| //add up file sizes | |
| filesSize+=file.size; | |
| } | |
| //check if files size is greater than 2MB or 2,000,000 bytes | |
| if(filesSize > requiredSize){ | |
| console.log("Files must not exceed 2MB in size"); | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment