Hi all,
I have big problem which I have noticed after last Umbraco update, but it could be something else, I am not sure that upgrade is the reason.
I have code where I can upload and delete images in Media section from the fronted of my website.
I have few fields where I can upload images. For example if I try to upload 1st image its okay, than if I upload one more image, again its all good, after that If I delete 1 od this images programatically it works good and than sometimes, not always which is so wierd i get this error:
Umbraco.Core.Exceptions.PanicException: 'failed to get last child with id=-1'
In this line:
IMedia uploadFile = Services.MediaService.CreateMediaWithIdentity(model.File.FileName, mediaFolderId, "Image");
This is my code for image upload to media section:
IMedia uploadFile = Services.MediaService.CreateMediaWithIdentity(model.File.FileName, mediaFolderId, "Image");
uploadFile.SetValue(Services.ContentTypeBaseServices, "umbracoFile", model.File.FileName, model.File.InputStream);
Services.MediaService.Save(uploadFile);
If i continue after that error and than try to delete some other Image i get this error:
Umbraco.Core.Exceptions.PanicException: 'failed to get next sibling with id=3709'
On this line:
Services.MediaService.Delete(item);
Please somebody help me with this, i can provide more informations if needed for better understunding.
BR
Josip