Copied to clipboard

Flag this post as spam?

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


  • Josip Pavlović 64 posts 249 karma points
    Mar 21, 2019 @ 21:02
    Josip Pavlović
    0

    Issue with uploading media in Umbraco 8

    Guys please help me with this. I am starting the new project and i want to use Umbraco 8, but I am running into the problems all the time. I checked documentation and it seems that nothing is changed about media service.

    I am trying to upload images in Media section with same code which i am using in Umbraco 7 (it works in Umbraco 7) but its not working.

    Also i have the same problem when i am using Upload data type but lets start with this...

    Model:

    [Required]
        public int GalleryId { get; set; }
    
        [Required]
        public IEnumerable<HttpPostedFileBase> Files { get; set; }
    

    Controller:

    [HttpPost]
        public ActionResult HandleFormSubmit(ImageGalleryFormViewModel model)
        {
            if (!ModelState.IsValid)
                return CurrentUmbracoPage();
    
            foreach (var file in model.Files)
            {
                var media = Services.MediaService.CreateMedia(file.FileName, 1051, "Image");
                media.SetValue("umbracoFile", file);
    
                Services.MediaService.Save(media);
    
            }
    
                TempData["success"] = true;
            return CurrentUmbracoPage();
        }
    
  • Jan Skovgaard 11222 posts 23231 karma points MVP 5x admin c-trib
    Mar 22, 2019 @ 06:41
    Jan Skovgaard
    0

    Hi Josip

    What error message do you get when executing the code posted if any?

    Also have you had a look in the log to see if it reveals any useful information?

    /Jan

  • Josip Pavlović 64 posts 249 karma points
    Mar 22, 2019 @ 12:39
    Josip Pavlović
    0

    Hi Jan,

    Yes i am getting this one Exception: Could not populate upload auto-fill properties for file '"System.Web.HttpPostedFileWrapper"'.

    System.IO.FileNotFoundException: Could not find file 'C:\Users\josip\source\repos\UmbracoOsam\UmbracoOsam\media\System.Web.HttpPostedFileWrapper'.
    File name: 'C:\Users\josip\source\repos\UmbracoOsam\UmbracoOsam\media\System.Web.HttpPostedFileWrapper'
       at System.IO.__Error.WinIOError(Int32 errorCode, String maybeFullPath)
       at System.IO.FileStream.Init(String path, FileMode mode, FileAccess access, Int32 rights, Boolean useRights, FileShare share, Int32 bufferSize, FileOptions options, SECURITY_ATTRIBUTES secAttrs, String msgPath, Boolean bFromProxy, Boolean useLongPath, Boolean checkHost)
       at System.IO.FileStream..ctor(String path, FileMode mode, FileAccess access, FileShare share)
       at Umbraco.Core.IO.PhysicalFileSystem.OpenFile(String path)
       at Umbraco.Core.IO.ShadowWrapper.OpenFile(String path)
       at Umbraco.Core.IO.FileSystemWrapper.OpenFile(String path)
       at Umbraco.Web.Media.UploadAutoFillProperties.Populate(IContentBase content, IImagingAutoFillUploadField autoFillConfig, String filepath, String culture, String segment)
    
  • Josip Pavlović 64 posts 249 karma points
    27 days ago
    Josip Pavlović
    0

    Any idea ?

  • Thomsen 71 posts 261 karma points
    26 days ago
    Thomsen
    0

    Hi Josip - we have been struggling with the same problem the whole day, using MediaService code that normally works in v7. A file/image in the media section in the specified folder is registered, but there is no thumbnail nor file sizes or anything registered, so basically a useless container to be found ... It must be a bug :-/

  • Josip Pavlović 64 posts 249 karma points
    26 days ago
    Josip Pavlović
    0

    Hi Thomsen i hope that someone will tell us soon what is the problem. I would like to use Umbraco 8 for the new project but cant if I dont solve this thing with images :/

  • Josip Pavlović 64 posts 249 karma points
    24 days ago
    Josip Pavlović
    0

    https://github.com/umbraco/Umbraco-CMS/issues/5102 Is this answer on our problem with uploading media?

    Can anybody share with me working example how to upload images programaticaly in Umbraco 8 , please.

    Thank you

  • Thomsen 71 posts 261 karma points
    24 days ago
    Thomsen
    0

    ... I'm still waiting to see the answer too, nothing really works for this issue yet, unfortunately :-/

Please Sign in or register to post replies

Write your reply to:

Draft