public static SupportFile[] MediaFiles() { SupportFile[] files = new SupportFile[]{}; string path = HttpContext.Current.Server.MapPath("~/media/"); DirectoryInfo d = new DirectoryInfo(path); // var x = d.GetFiles()[0]. FileInfo[] fi = d.GetFiles(); if (fi.Length > 0) { files = fi.Select(f => new SupportFile { Name = f.Name, SizeKb = f.Length / 1024, FileType = f.Extension }).ToArray(); } return files; }
public bool DeleteMediaFile(SupportFile file) { return file.Delete(); }