Copied to clipboard

Flag this post as spam?

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


  • Stephanie Spears 3 posts 73 karma points
    Apr 12, 2019 @ 21:16
    Stephanie Spears
    0

    Path Mapping For Media Uploads

    My company is currently using Umbraco 7.13.2, and in Back Office our Media section has the following content tree: /media/images/assets /media/images/content /media/images/products /media/documents /media/files

    By default, images uploaded via Back Office are assigned an incrementing folder id, so that "myimage.jpg" is given the path "/media/1001/myimage.jpg".

    I would like to be able to make the Back Office folder path match the actual folder path--so, for instance, instead of automatically being assigned to "/media/1001/myimage.jpg" it will instead be assigned to "/media/content/myimage.jpg".

    I can't seem to find where the folder value is being set, so even that information alone would be incredibly helpful.

    Any help would be grealy appreciated, thanks!

  • Proxicode 128 posts 324 karma points
    Apr 13, 2019 @ 20:42
    Proxicode
    1

    Hi Stephanie,

    The short answer is that there is no easy way to configure the media or media folders path. So you are not missing it, it's just not available in the back office. You could relatively easily change the media root folder to not be "media" by going under the Developer==>Settings tab in the back office and finding the FileSystemProviders.config file and changing it there, but it doesn't sound like that is quite what you're after.

    The long answer is that I've recently gone through a similar task with a client who did not want the "Id" folder structure at all for media and I can tell you it is quite a large hill to climb, but you can do it. Also approach this knowing that a lot of thought and work has gone into the way that Umbraco does this natively, and why they do it this way.

    I learned the hard way that as soon as you move away from the default file/folder structure you have to start thinking about how image preview will work when things aren't where Umbraco expects them to be, or how "Move" and "Delete" in the back office will work. None of this is to discourage you, but I'm just sharing what I learned and the things that I wish I'd known or thought of before I started.

    So the two real options (that I know of) are to create your own file systems provider for Umbraco, which several people have done for saving to different cloud platforms etc. The other option is to override the media events in a custom c# controller and handle them in your custom way there. If this sounds like an option, let me know and I'll be more than happy to share code and help where I can.

    If you want to read up on the code, you can do some Googling for Umbraco MediaServiceSaved or MediaServiceSaving events to see what's involved.

    Hope that helps, and please post back if you choose proceed.

    Thanks :-)

    -Roger

  • Stephanie Spears 3 posts 73 karma points
    Apr 15, 2019 @ 12:54
    Stephanie Spears
    0

    Hey Roger, thanks so much for your reply!

    I played around a bit with the MediaServiceSaved/Saving for about a week but I eventually tossed it all out, since I wasn't entirely sure what I was doing. I would love to see what you've done with your custom controllers, that would be immensely helpful.

    Talk to you soon!

    Stephanie

Please Sign in or register to post replies

Write your reply to:

Draft