コード例 #1
0
        public async Task <IActionResult> Download(string fileName)
        {
            var folderPath = storageManager.GetFolderPath("Test", "1234", "Files");
            var fileBytes  = await storageManager.DownloadAsync(fileName, folderPath);

            if (fileBytes == null)
            {
                return(NotFound());
            }

            return(File(fileBytes, "application/octet-stream", fileName));
        }
コード例 #2
0
        public async Task <IActionResult> Download(string id)
        {
            var storage = await _context.FileStorages.FindAsync(id);

            if (storage != null)
            {
                var data = await _storageManager.DownloadAsync(storage.FileId);

                return(File(data, storage.FileType));
            }
            else
            {
                return(NotFound());
            }
        }
コード例 #3
0
 /// <summary>
 /// Retrieve binary data of the file on the cloud.
 /// </summary>
 /// <param name="fileStorage">A FileStorage object contains file's information on the cloud</param>
 /// <returns>A byte array represent binary data of the file.</returns>
 public Task <byte[]> GetFile(FileStorage fileStorage) => storageManager.DownloadAsync(fileStorage.FileId, "fileid");