Copied to clipboard

Flag this post as spam?

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


  • Simone Chiaretta 134 posts 541 karma points c-trib
    Oct 20, 2016 @ 12:42
    Simone Chiaretta
    0

    Error when moving the media folder to a different location: FileSecurityException

    I need to change the location of the media folder, moving it from the ~/media virtual folder to an external NAS with its own physical path and url.

    I changed the FileSystemProviders.config file by removing the virtualRoot parameter and by adding rootPath and rootUrl.

      <Provider alias="media" type="Umbraco.Core.IO.PhysicalFileSystem, Umbraco.Core">
        <Parameters>
          <add key="rootPath" value="C:\Temp\UmbracoMedia" />
          <add key="rootUrl" value="//whatever.example.com/umbracomedia/" />
        </Parameters>
      </Provider>
    

    After the change new files are correctly stored into the new path and accessibile with the new url, but the ones I saved before the change are still only accessible at the old /media url and not at the new one, even if I moved the physical files to the new location.

    On top of this, I cannot edit old files as I get an exception:

    Umbraco.Core.IO.FileSecurityException: File '/media/1051/koala.jpg' is outside this filesystem's root.

    I want to clarify that I moved the files to the new rootPath Any idea of how to move the URLs of old files to the new location?

    Thx

    Simone

  • Paul Sterling 718 posts 1534 karma points MVP 9x admin c-trib
    Oct 20, 2016 @ 20:58
    Paul Sterling
    100

    @Simone

    That makes sense if you haven't updated the media item's property for the path as it will still be the original (relative) media path, i.e., /media/1052/kitten.png

    So, if you have existing media that you've hoisted to your new storage location you'll need to update the media item property path to reflect the new location. You could use the MediaService for this or go straight to the database. Using the MediaService is the recommended approach of course.

    For example, when we have sites with existing media that then switch to using the Azure Blob Storage Provider we need to update the media path to the fully qualified url the media item http://dogsdrool.blob.core.windows.net/media/1052/kitten.png

  • Simone Chiaretta 134 posts 541 karma points c-trib
    Oct 21, 2016 @ 07:12
    Simone Chiaretta
    0

    Yeah, I realized that myself already :)

    But I don't think this is how people expect it to work: looking on "our" I found many posts (without an answer) about changing the location of the media folder and not seeing it applied to old media.

    I expect that changing the configuration and moving the old media files to the new location would work.

    The fact that no documentation on this is available doesn't help.

    I'll write the doc and send a pull request :)

  • Shannon Deminick 1526 posts 5272 karma points MVP 3x
    Oct 21, 2016 @ 07:20
    Shannon Deminick
    0

    have replied with some detail about this here: http://issues.umbraco.org/issue/U4-9086

  • Arlan Galvez 44 posts 175 karma points
    Apr 27, 2017 @ 15:50
    Arlan Galvez
    0

    Hi I have a similar issue. When I try to delete one of my old custom media content with images I get this error and I can't delete any of the medias uploaded before change it to Azure Blob Storage:

     ERROR ImageProcessor.Web.HttpModules.ImageProcessingModule - 
        ImageProcessor.Common.Exceptions.ImageProcessingException: ProcessImageAsync 597 : No image exists at D:\home\site\wwwroot\media\1034\case-659x420.jpg
    

    What would be the problem? This iaaue don't let me modify or delete the medias after we move the media folder to Azure Blob Storage.

    Complete issue and discussion on stackoverflow

Please Sign in or register to post replies

Write your reply to:

Draft