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:
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.
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().
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.
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:
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
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?
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().
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.
Thanks for that explanation Sebastiaan!
is working on a reply...