PDA

View Full Version : How to determine external file's mime type


gooch
04-28-2008, 09:02 PM
I am working on a sorta video player/image slideshow kinda thingie (that's the technical term, and I'm sticking to it!). I want to load either .flvs or .jpg into the same presentation area, one at a time. Is there a way to determine external file's mime type so I can choose dynamically which method to use for loading - the FLVPlayback component or loadMovie. All I can think of is to use the extension from the file name. Is there a better way? Is there an equivalent of php's mime_content_type?

gooch
04-28-2008, 09:37 PM
Here's my lame workaround. Turn the file url into an array, splitting by ".", and assuming that the last array item is the extension:

var fileType:Array = fileUrl.split(".");
fileType = fileType[fileType.length-1];

Is there a better, more accurate way?