Exemple #1
0
        public async Task <ActionResult> GetUploadDataAsync([FromRoute] Guid uploadId, [FromRoute] int dl = 0)
        {
            var upload = await DbContext.Uploads.Include(x => x.LocalFile)
                         .Where(x => x.Id == uploadId)
                         .FirstOrDefaultAsync();

            if (upload == null)
            {
                return(NotFound("Invalid uploadId"));
            }

            AddContentDispositionHeader(upload, dl == 1);

            byte[] uploadData = await DataService.LoadUploadDataAsync(upload.LocalFile);

            return(File(uploadData, upload.ContentType));
        }
Exemple #2
0
        public async Task <string> LoadContentAsTextAsync()
        {
            byte[] data = await DataService.LoadUploadDataAsync(Upload.LocalFile);

            return(Encoding.ASCII.GetString(data));
        }