Skip to content

Blazor Support Large File Uploads #33638

@christophwille

Description

@christophwille

I have a working Blazor Web Assembly app that uploads files to Azure Storage (server provides SAS token urls, client upload to that destination). This works a-ok for "small" files the size of a couple 100MBs. However, I now have a 6.8GB file that doesn't - I am using bog standard code along the lines of the documentation:

Azure.Response<BlobContentInfo> azresponse = await blobClient.UploadAsync(fileStream, new BlobUploadOptions()
{
  ProgressHandler = new Progress<long>((progress) =>
  {
     vm.ProgressBarPercentage = (int)(100.0 * progress / vm.InputFileSize);
     this.StateHasChanged();
  })
});

For this large file, it returns immediately and creates a zero byte file on Azure Storage. I then tried this:

 var x = new byte[200];
 int res = await fileStream.ReadAsync(x, 0, 100);

Surprisingly, res is 0 so I see why the storage library would create a 0 byte file... but I don't get why Blazor behaves that way. (Note: I didn't test to see at what file size this behavior kicks in). I also didn't see anything that would indicate any sort of error. The stream simply isn't returning data.

Metadata

Metadata

Assignees

Labels

DoneThis issue has been fixedarea-blazorIncludes: Blazor, Razor ComponentsbugThis issue describes a behavior which is not expected - a bug.feature-blazor-builtin-componentsFeatures related to the built in components we ship or could ship in the futurefeature-blazor-serverfeature-blazor-wasmThis issue is related to and / or impacts Blazor WebAssembly

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions