Copied to clipboard

Flag this post as spam?

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


  • Filipe Sousa 43 posts 205 karma points
    Feb 16, 2018 @ 16:11
    Filipe Sousa
    0

    Uploaded images using media service disappear

    I'm having an issue after uploading images on a page in the frontend. These get saved on a folder in the media section. I'm using mediaService.CreateMedia() and mediaService.Save().

    The images get saved properly but once Umbraco restarts (e.g. when updating dlls) the images disappear from the media section of the backoffice although they're still in the media folder. I wonder if the cache needs updated somehow?

    Might be worth noting that "ImageApproval" is a custom media type. My Umbraco version is 7.7.6.

    Relevant code bellow:

    var mediaService = Services.MediaService;
                        var media = mediaService.CreateMedia(imageName, settings.ImageFolderId.Value, "ImageApproval");
                        mediaService.Save(media);
                        media.SetValue("umbracoFile", model.Image);
                        media.SetValue("firstName", model.FirstName);
                        media.SetValue("lastName", model.LastName);
                        media.SetValue("emailAddress", model.EmailAddress);
                        media.SetValue("facebookProfile", model.FacebookProfile);
                        media.SetValue("twitterProfile", model.TwitterProfile);
                        media.SetValue("instagramProfile", model.InstagramProfile);
                        mediaService.Save(media);
    

    I just compared database snapshots from before and after rebuilding the solution. Left is before and right is after. Somehow some fields were removed from various tables. How can this happen?

    enter image description here

    enter image description here

    enter image description here

    enter image description here

  • Filipe Sousa 43 posts 205 karma points
    Feb 16, 2018 @ 17:58
    Filipe Sousa
    0

    Turns out it was a delete action on uSync. Still not sure how it found it's way there.

Please Sign in or register to post replies

Write your reply to:

Draft