Get all images from folder asp.net

73

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);
}

Comments

Submit
0 Comments