I use the FilePicker to let the user select a file. I want to determine the type of the file so I can show different visuals. How can I see what's in the file?
The easiest way is probably to look at the ContentType
property of a file. The ContentType contains the MIME type of the file. So this can be "audio/mpeg". You can also look at the first part if you want to do the same for all images or videos for instance.
You can use StartsWith()
method for this. E.g.:
item.IsVideo = file.ContentType.StartsWith("video/");
You can find lists of well known mime types on the internet. This is a good example: http://webdesign.about.com/od/multimedia/a/mime-types-by-file-extension.htm