Just had a thought and maybe I am missing something here.
When creating a media item it gets assigned an ID, being the Id from the database table.
Just wondering why the actual folder created within the media directory couldn't be the same as the media ID from the database table.
The reason for asking is that I have just built a web service for content delivery and replicating media items. It would be soooo much simpler if you knew the folder name in the media section was the same as the ID of the media item in the dB table.
Any thoughts / clarification as to why they aren't the same ?
I don't know the exact thought process behind the naming of the media folders, but I do know that they're named by the property ID. Perhaps they did this to avoid name conflicts if you have two upload fields on a doc/media type - this way they can both have files uploaded with the same name since they'll be in different folders based on their property id.
Also, not sure if this helps you or not, but this is a helper method I've used a while back to get a Media item based on it's file path. GetMediaByPath
Media ID's of Media Items and Folder Names
Hey
Just had a thought and maybe I am missing something here.
When creating a media item it gets assigned an ID, being the Id from the database table.
Just wondering why the actual folder created within the media directory couldn't be the same as the media ID from the database table.
The reason for asking is that I have just built a web service for content delivery and replicating media items. It would be soooo much simpler if you knew the folder name in the media section was the same as the ID of the media item in the dB table.
Any thoughts / clarification as to why they aren't the same ?
Cheers, nigel
I don't know the exact thought process behind the naming of the media folders, but I do know that they're named by the property ID. Perhaps they did this to avoid name conflicts if you have two upload fields on a doc/media type - this way they can both have files uploaded with the same name since they'll be in different folders based on their property id.
Also, not sure if this helps you or not, but this is a helper method I've used a while back to get a Media item based on it's file path. GetMediaByPath
-Tom
UPDATE: looks like a more generic method was added to uComponents 4.1.0: http://ucomponents.codeplex.com/SourceControl/changeset/f74faf78951d
is working on a reply...