Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • Linx 98 posts 258 karma points
    Mar 09, 2023 @ 11:32
    Linx
    0

    How to determine the type of file content is linked to?

    Hi guys

    I am retrieving content using C# code which is working great via the IPublishedCache (UmbracoCOntext.Content and UmbracoContext.Media)

    How could i determine what file type is being used as a general document has

    umb://document// 
    

    in the URL, but a media file has

    umb://media/
    

    Ideally i just want to take an action once i have determined the type of file it is.

    Was considering to check if the URL contains media or document in the URL but think there must be a better way.

    Thanks

  • Huw Reddick 1727 posts 6066 karma points MVP c-trib
    Mar 09, 2023 @ 13:51
    Huw Reddick
    0

    The returned value from umbracoContext.Media or .Content has an ItemType property, is that what you need?

Please Sign in or register to post replies

Write your reply to:

Draft