I currently am trying to upload a pdf file of size 260kb with Swagger UI and it doesnt work. If I try to do the same thing with a small 50kb Word file it works.
My controller code is:
    [HttpPost()]
    public async Task<IActionResult> Upload(IFormFile file)
    {
        var name = SanitizeFilename(file.FileName);
        if (String.IsNullOrWhiteSpace(name))
        {
            throw new ArgumentException();
        }
        using (Stream stream = file.OpenReadStream())
        {
            await storage.Save(stream, name);
        }
        
        return Accepted();
    }
My AzureBlobStorage class's save method is:
        public async Task<Task> Save(Stream fileStream, string name)
    {
        var blobContainer = await GetBlobContainerAsync();
        CloudBlockBlob blockBlob = blobContainer.GetBlockBlobReference(name);
        var task = blockBlob.UploadFromStreamAsync(fileStream);
        var success = task.IsCompletedSuccessfully;
        return task;
        //return blockBlob.UploadFromStreamAsync(fileStream);
    }
Here is some of the debug windows:
- This is from the controller of the word document:
 
- This is from the controller of the PDF document:
 
Notice the red/pink lettering which is different.
- This is from the AzureBlobStorage save method - word document:
 
- This is from the AzureBlobStorage save method - pdf document:
 
I have read the IFormFile might not do continuous streaming but how do I know if that is the issue? And if it is, what is the preferred approach?



