Copied to clipboard

Flag this post as spam?

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


  • Tom 713 posts 954 karma points
    Sep 25, 2017 @ 04:54
    Tom
    0

    GetFileSystemProvider<MediaFileSystem> - Console App "'No provider found with the alias 'media''"

    Hi all just spiking out optimising some already uploaded images where I'd loop through images and run them through tinyfy.com I've hooked this up for the save event for media but wanted to optimise all the legacy/previously uploaded images.

    I'm trying to call:

    var media = FileSystemProviderManager.Current.GetFileSystemProvider<MediaFileSystem>();
    

    so ultimately I can call something like so:

    using (var dataStream = dataResponse.Content.ReadAsStreamAsync().Result)
                            {
                                media.AddFile((string)mediaItem.GetValue("umbracoFile"), dataStream, true);
                            }
    

    and getting 'No provider found with the alias 'media'' I have access to the content type service and media service in the same app with no issues and was wondering what I might be missing.

    Thanks

Please Sign in or register to post replies

Write your reply to:

Draft