We are using this method in such situation, it removes all images from media section:
/ClearMedia/
public ActionResult Index()
{
if (ApplicationContext.Current == null) return new HttpStatusCodeResult(404);
//Use the MediaService to create a new Media object (-1 is Id of root Media object, "Folder" is the MediaType)
//Use the MediaService to Save the new Media object
var images = string.Empty;
foreach (var media in ApplicationContext.Current.Services.MediaService.GetRootMedia().Where(media => media.ContentType.Name.Equals("Image")))
{
images += media + " " + media.Id + "/r/n ";
ApplicationContext.Current.Services.MediaService.MoveToRecycleBin(media);
}
ApplicationContext.Current.Services.MediaService.EmptyRecycleBin();
return Json(new { images });
}
But try to remove this method after using or add authorization filter for security ))
Bulk delete from Media folder
Hi,
I am working in Umbraco 7.2.4.
I need to delete some images and uploaded new one.
For that I need to manualy delete images one by one.
Is there any way to delete images in bulk from one folder?
Any help or suggestion would be appreciate.
Thanks in advance.
Regards,
Urvish Mandaliya
Hi Urvish,
We are using this method in such situation, it removes all images from media section:
But try to remove this method after using or add authorization filter for security ))
Thanks, Alex
ok Thanks Alex for the reply.
Is there any way to delete from Umbraco back-office?
Regards,
Urvish Mandaliya
No, you can do that only via code. Thats why we suggest always upload medias in folders, it looks better and we can remove all folder.
Thanks, Alex
ok Thanks Alex for the help.
Regards,
Urvish Mandaliya
is working on a reply...