javascriptvalidationwma

Audio WMA incorrectly reported as video/x-ms-wma


Having to handle audio WMA files as part of an upload script but I've run across a really annoying bug with the file type.

I need to only allow audio, NOT video but it seems that all WMA files have the type of :

video/x-ms-wma

Whether they contain video or not.

I was expecting :

audio/x-ms-wma

But this doesn't seem to be the case and it means that I can't validate the type correctly with javascript as :

file.type.match('audio.*')

Which is obviously failing here.

Are there any workarounds for this?


Solution

  • I had the same issue. It was a Chrome bug in my case.

    Solved using regex: file.type.match(/audio|wma/)

    This matches the text audio or wma.