Blazor File Upload Issues

865 views Asked by At

I am writing my first Blazor (Server Side) app and have run into a big issue with errors when trying to upload files. To be clear it works for some people but not for others. Everyone is using the same browser but people are in different locations at my work, connected via WAN.

Here is the Exception that is being thrown :

An error occurred while reading the remote stream: TypeError: r.arrayBuffer is not a function

It is being thrown by

CopyToAsync(fs)

I have tried Microsoft own code, literally, but still getting an exception.

await using FileStream fs = new(path, FileMode.Create);
await browserFile.OpenReadStream().CopyToAsync(fs);

I separated the code to find where the exception was being thrown

using var input = file.OpenReadStream(maxAllowedSize);
using FileStream fs = new(filePath, FileMode.Create);
input.CopyToAsync(fs);

I have even tried reading directly to a MemoryStream which Microsoft warns against, but in all cases there is the same exception when CopyToAsync() is called.

Any help regarding this issue would be appreciated. Any workarounds would be appreciated as well.

0

There are 0 answers