How do I upload media without the ID in the filename?
Basically I have a web application where I want my client to be able to upload a collada 3D model and it's textures to be used in a 3D model viewer I built. The problem is that when they upload media it uploads each media item into it's own folder (the ID). I was hoping that setting the UploadAllowDirectories to false in the umbracoSettings.config file would allow me to achieve what I want, but when I set it to false it prepends the filename with the ID instead of creating a directory with the ID. Is there any way that I can set Umbraco to not manage the media's filenames for me? I understand that they might overwrite files and such, I just need this sort of control because the collada 3D models have relative path references to their textures and I don't want the client to have to edit the model AFTER they upload the texture. Any ideas?
In this case you'll have to create an event handler that hooks into the MediaItem.Save event, and move the uploaded file to a directory of your choice. One approach would be to create a folder media object, and move files based on their parent. It's 7AM, and I'm not fully awake yet, but there's an idea to show you the direction. If you don't know what an event handler is, try looking in the books section, the wiki and the forum.
How do I upload media without the ID in the filename?
Basically I have a web application where I want my client to be able to upload a collada 3D model and it's textures to be used in a 3D model viewer I built. The problem is that when they upload media it uploads each media item into it's own folder (the ID). I was hoping that setting the UploadAllowDirectories to false in the umbracoSettings.config file would allow me to achieve what I want, but when I set it to false it prepends the filename with the ID instead of creating a directory with the ID. Is there any way that I can set Umbraco to not manage the media's filenames for me? I understand that they might overwrite files and such, I just need this sort of control because the collada 3D models have relative path references to their textures and I don't want the client to have to edit the model AFTER they upload the texture. Any ideas?
Thanks in advance!
In this case you'll have to create an event handler that hooks into the MediaItem.Save event, and move the uploaded file to a directory of your choice. One approach would be to create a folder media object, and move files based on their parent. It's 7AM, and I'm not fully awake yet, but there's an idea to show you the direction. If you don't know what an event handler is, try looking in the books section, the wiki and the forum.
Regards,
Stephan
Thanks Stephan! I just noticed that there is a video showing me how to do it under the videos section so that should make it 10x easier. Thanks again!
is working on a reply...
This forum is in read-only mode while we transition to the new forum.
You can continue this topic on the new forum by tapping the "Continue discussion" link below.