public string UpImg(IFormatProvider file, string filename) { if (file == null || !ContentType.StartsWith("image")) { return(null); } else { string ext = Path.GetExtension(file.FileName); filename = $"{filename}{ext}"; using (FileStream fs = File.Create(filename)) { file.CopyTo(fs); fs.Flush(); } return(ext); } }