I\'m working through a small file upload script (learning experience) and I noticed that when selecting microsoft office related files (.doc
or .docx
f
According to the W3 File Api Draft the type attributte:
The ASCII-encoded string in lower case representing the media type of the Blob, expressed as an RFC2046 MIME type [RFC2046]. On getting, conforming user agents SHOULD return the MIME type of the Blob, if it is known. If conforming user agents cannot determine the media type of the Blob, they MUST return the empty string. A string is a valid MIME type if it matches the media-type token defined in section 3.7 "Media Types" of RFC 2616
So basically, if it's not a valid or media-type of HTTP/1.1 it will be empty. Anyways.
Yeah, you should do something like:
if(type === "") {
//Get extension and match to a MIME-types list. (http://www.htmlquick.com/es/reference/mime-types.html)
}