Hi all,
I am working with Umbraco 8 and I cant upload the Image in media file from the frontend of my website.
Code which I am using working fine in Umbraco 7, but cant get ti work in Umbraco 8.
tHIS IS ecception from Log viewer
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)
What I have tried:
Controller:
foreach (var file in model.Files)
{
var media = Services.MediaService.CreateMedia(file.FileName, 1051, "Image");
media.SetValue("umbracoFile", file);
Services.MediaService.Save(media);
}
Model:
[Required]
public IEnumerable<HttpPostedFileBase> Files { get; set; }