예제 #1
0
        private HttpResponseMessage Download(FileObject fileObject)
        {
            string     physicalFullPath = fileObject.GetPhysicalPath();
            FileStream fileStream       = new FileStream(physicalFullPath, FileMode.Open, FileAccess.Read);

            HttpResponseMessage response = new HttpResponseMessage();

            response.Content = new StreamContent(fileStream);
            response.Content.Headers.ContentType        = new MediaTypeHeaderValue("application/octet-stream");
            response.Content.Headers.ContentDisposition = new ContentDispositionHeaderValue("attachment")
            {
                //FileName = fileObject.Name,
                FileNameStar = fileObject.Name
            };
            return(response);
        }