I have a download section, and i would like to have icons for the different files according to their file type. So i have a pdf icon on the link for a downloadable .pdf, a word icon for an .doc and so on.
How do i get the file type/suffix for a media file?
Getting file type of media
I have a download section, and i would like to have icons for the different files according to their file type. So i have a pdf icon on the link for a downloadable .pdf, a word icon for an .doc and so on.
How do i get the file type/suffix for a media file?
Hi Claus
That can actually be achieved purely by using CSS - See this tutorial for instance http://www.hongkiat.com/blog/css3-attribute-selector/
This pen might also be useful http://codepen.io/tevko/pen/DdsnK
Hope this helps.
/Jan
Hi Claus,
If you want to get the file type of media in razor code you could do it like this:
In the example I am using the media picker.
Hope this helps,
/Dennis
Thanks both of you. H5YR
I'll mark Jans as the solution as its the most flexible in my case.
If you want to get the file type in a UmbracoApiController you can do the following:
That is assuming you already have the file Id of the document you are interested in.
is working on a reply...