private string SaveStream(Stream stream) { string path = HostingEnvironment.MapPath("~/Files") + "/"; string fileName = CoreUtils.RandomString(5) + ".jpg"; string filePath = Path.Combine(path, fileName); using (Stream file = File.OpenWrite(filePath)) { CoreUtils.CopyStream(stream, file); } return(MapURL(fileName)); }
private string SaveZip(string patientID, Stream stream) { string path = HostingEnvironment.MapPath("~/Files") + "/"; string fileName = patientID + "_" + CoreUtils.RandomString(5) + ".zip"; string filePath = Path.Combine(path, fileName); CheckPath(path); using (Stream file = File.OpenWrite(filePath)) { CoreUtils.CopyStream(stream, file); } return(MapURL(fileName)); }
private string Save(string authenticationCookie, string hint, string ext, Stream stream) { string logicalFileName = hint + CoreUtils.RandomString(5) + ext; string path = Path.Combine(HostingEnvironment.MapPath("~/Files"), PathSafe(authenticationCookie)); string physicalFileName = _hasing.GetHashString(logicalFileName + authenticationCookie); string filePath = Path.Combine(path, physicalFileName); CheckPath(path); using (Stream file = File.OpenWrite(filePath)) { CoreUtils.CopyStream(stream, file); } return(logicalFileName); }