Get all images from folder asp.net

Code Example - Get all images from folder asp.net

                
                        public IActionResult OnGet()
{
	var provider = new PhysicalFileProvider(webHostEnvironment.WebRootPath);
	var contents = provider.GetDirectoryContents(Path.Combine("uploadedfiles", "images"));
	var objFiles = contents.OrderBy(m => m.LastModified);
   
	return new JsonResult(objFiles);
}