Skip to content

Instantly share code, notes, and snippets.

@Wildanzr
Created March 24, 2023 09:29
Show Gist options
  • Save Wildanzr/7dbed9e4d4f4511d5405d6c86fa2bbc9 to your computer and use it in GitHub Desktop.
Save Wildanzr/7dbed9e4d4f4511d5405d6c86fa2bbc9 to your computer and use it in GitHub Desktop.
const acceptedFileTypes = [
"image/jpeg",
"image/png",
"image/svg+xml",
"video/mp4",
"video/quicktime",
"video/webm",
"application/pdf",
"application/msword",
"application/vnd.openxmlformats-officedocument.wordprocessingml.document",
"application/vnd.ms-powerpoint",
"application/vnd.openxmlformats-officedocument.presentationml.presentation",
];
// Membuat fungsi validasi file
const validateFileTypes = (file) => {
if (!acceptedFileTypes.includes(file.mimetype)) {
return false;
}
return true;
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment