示例#1
0
        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));
        }
示例#2
0
        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));
        }
示例#3
0
        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);
        }