Copied to clipboard

Flag this post as spam?

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


  • Rene Becker 5 posts 76 karma points
    Apr 18, 2019 @ 10:53
    Rene Becker
    0

    FileSystemProviders Section umbraco 8 to change media location

    Hi, Where is the FileSystemProvidersSection in umbraco 8? I wanna change the media location.

  • Dave de Moel 114 posts 515 karma points c-trib
    Apr 18, 2019 @ 11:44
    Dave de Moel
    2

    In Umbraco 8 you do this using a composer to create a custom physical file system instance.

    public class MediaComposer : IUserComposer
    {
        public void Compose(Composition composition)
        {
            composition.SetMediaFileSystem(() => new PhysicalFileSystem("~/CustomMedia"));
        }
    }
    

    More about composing you can read here: https://our.umbraco.com/documentation/Implementation/Composing/

  • Hugo Becerra 10 posts 80 karma points
    Aug 16, 2019 @ 10:05
    Hugo Becerra
    0

    Hi Dave,

    Is possible to use a network location as media folder with this method?

    Thanks!

  • Dave de Moel 114 posts 515 karma points c-trib
    Aug 16, 2019 @ 11:38
    Dave de Moel
    1

    You'll need to create a custom FileSystemProvider for that, which you can then set using above method:

    public class MediaComposer : IUserComposer
    {
        public void Compose(Composition composition)
        {
            composition.SetMediaFileSystem(() => new MyCustomFileSystem());
        }
    }
    

    Though if your network location is the Azure Blob storage you can use the following: https://our.umbraco.com/documentation/Extending/FileSystemProviders/Azure-Blob-Storage/

  • Hugo Becerra 10 posts 80 karma points
    Aug 16, 2019 @ 13:25
    Hugo Becerra
    0

    Ok, then I have to create a totally new class to handle images because the existing one doesn´t support network locations? Wow, a lot of work.

    Thanks for your help!

  • Alex Skrypnyk 5329 posts 19613 karma points MVP 3x admin c-trib
    14 days ago
    Alex Skrypnyk
    0

    Hi Dave,

    Do you know what to do with already uploaded images into /media folder?

    Thanks,

    Alex

  • Dave de Moel 114 posts 515 karma points c-trib
    14 days ago
    Dave de Moel
    0

    I have never ran into a situation where reuploading wasn't an option, But I guess if that isn't an option, just uploading the folders in the media section to the remote storage should work if you use the virtual path provider, as the internal relative url's in Umbraco don't change then.

Please Sign in or register to post replies

Write your reply to:

Draft