Copied to clipboard

Flag this post as spam?

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


  • Joshua Walsh 30 posts 151 karma points
    Jul 29, 2015 @ 00:33
    Joshua Walsh
    0

    Number in media URL

    Hi,

    When you upload a file in Umbraco (using the File Upload property editor) it is placed in a numbered folder inside /media. It can then be accessed at a URL looking like: /media/547875/test.png

    My question is, where does the number (547875) come from? People in this thread suggest that it's the ID of the propertyData that the item belongs to. In my case this is not true:

    SQL

    As you can see, the property that references this media item has a completely different ID. Further, the property with ID 547875 belongs to a node with ID 5350, whereas my test media has an ID of 5375.

    So where does the number 547875 come from? Can anyone point me to the line of code that generates this URL? I tried to find it myself on GitHub but quickly became lost in Umbraco's codebase.

    Thanks,

    Josh

  • John Churchley 272 posts 1258 karma points c-trib
    Jul 29, 2015 @ 12:47
    John Churchley
    1

    Hi Josh,

    What's the reason you require the number? Maybe someone might be able to suggest an alternative to the solution your trying to come up with?

  • Joshua Walsh 30 posts 151 karma points
    Aug 13, 2015 @ 02:15
    Joshua Walsh
    0

    Largely it was out of curiosity. I did have a case where I was trying to find the media item that owned each number, but I eventually gave up, grabbed the filename as well and used MediaService.GetMediaByPath().

  • Sebastiaan Janssen 5045 posts 15477 karma points MVP admin hq
    Jul 29, 2015 @ 18:30
    Sebastiaan Janssen
    102

    The number USED to be the ID of the propertyData before v6. Now it's just a incrementing number so Umbraco scans the media folder, finds the highest number, increases it with 1 and that's the folder number.

  • Joshua Walsh 30 posts 151 karma points
    Aug 13, 2015 @ 02:16
    Joshua Walsh
    0

    Thanks for that explanation Sebastiaan!

Please Sign in or register to post replies

Write your reply to:

Draft