vendredi 11 mai 2018

JavaScript check upload type

I have a simple form to upload a video. I am doing a check on the type as follows:

if ($fileSelected.type === 'video/mp4' || $fileSelected.type === 'video/ogg' || $fileSelected.type === 'video/webm' || $fileSelected.type === 'video/avi') {}

I wanted to know if there is perhaps a better, neater way or shorthand way of doing the above? Maybe using new ES6 syntax & methods?

All help is greatly appreciated :)

Aucun commentaire:

Enregistrer un commentaire