Copied to clipboard

Flag this post as spam?

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


  • Nathan Woulfe 447 posts 1665 karma points MVP 5x hq c-trib
    Mar 30, 2012 @ 08:24
    Nathan Woulfe
    0

    Get media item without Id

    Hoping someone can help - I'm trying to get a media item, but only have its url, no id. Is it possible? I'm working on 4.7.1.

    I don't want to use xslt, or direct db queries. Hoping for a nice clear c# solution...

     

    cheers

    Nathan

     

  • Dimitris Tsoukakis 33 posts 59 karma points
    Mar 30, 2012 @ 09:47
    Dimitris Tsoukakis
    0

    Hi Nathan,

    I'm afraid that the only way is a direct db query.

    One like this: http://our.umbraco.org/forum/developers/api-questions/4284-getting-media-Id-from-path

    When I was working on a similar module like Ismail I didn't find a better workaround.

    Cheers,
    Dimitris 

     

  • Nathan Woulfe 447 posts 1665 karma points MVP 5x hq c-trib
    Mar 31, 2012 @ 01:37
    Nathan Woulfe
    0

    Thanks Dimitris, I thought as much... Will just use HttpWebRequest instead - I'm only after the file size, thought it coulde be done natively

     

    N

  • Dimitris Tsoukakis 33 posts 59 karma points
    Mar 31, 2012 @ 12:41
    Dimitris Tsoukakis
    0

    If you're after the size, I think FileInfo will be faster. Test it and see what's better for you.

     

    D

Please Sign in or register to post replies

Write your reply to:

Draft