public static bool Upload(byte[] stream, string name2Save, string folder2Save) { var path = HttpContext.Current.Server.MapPath(folder2Save); if (!Directory.Exists(path)) { Directory.CreateDirectory(path); } path = Path.Combine(path, name2Save); if (File.Exists(path)) { File.Delete(path); //If exists then delete file } ResizeImage.ImageNoResize(stream, path, 90); return(true); }