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
| function checkFileExtension(file, ...allowFileTypes) { | |
| const allowedExtensions = allowFileTypes; // List allowed extensions | |
| const fileExtension = file.name.split('.').pop().toLowerCase(); | |
| return allowedExtensions.includes(fileExtension); | |
| } | |
| function checkContentType(file) { | |
| const allowedTypes = ['image/jpeg', 'image/png', 'application/zip', 'application/pdf']; // List allowed MIME types | |
| return allowedTypes.includes(file.type); | |
| } |
NewerOlder