Example #1
0
        public virtual FileReference Save(Stream stream, string path, bool overwrite = false)
        {
            path = GetFullPath(path);
            if (File.Exists(path) && !overwrite)
            {
                path = _pathHelper.UniqueFileName(path);
            }

            long size;

            using (Stream file = File.Create(path))
            {
                stream.CopyTo(file);
                size = file.Length;
            }

            return(BuildFileReferenceResponse(path, (int)size));
        }