示例#1
0
        public async Task Upload(IFormFile formFile, FileTypeEnum fileType)
        {
            if (formFile.Length > 0)
            {
                await CreateFileRecord(formFile.FileName, fileType);

                var containerName = GetBlobContainerName(fileType);
                var fileStream    = formFile.OpenReadStream();
                await _azureStorageService.UploadBlob(containerName,
                                                      fileType == FileTypeEnum.HolidayPolicy
                                                      ?_configuration["FileConfig:HolidayPolicyFileName"]
                                                      : formFile.FileName, formFile.ContentType, fileStream);

                fileStream.Close();
            }
        }