Open Closed

Upload large file from Blazor WASM directly to blobstorage #4481


User avatar
0
Sturla created

Before I begin I would like to have some validation on my approach.

I need to upload big files (+3GB) to Azure blob storage from Blazor WASM.

I did set this up so that the files are streamed through an API to the service where they are then moved from there to a blob storage. This is an extra step from just going directly to blob and takes space and resources from the server.

So my question is: can't I just us https://docs.abp.io/en/abp/7.0/Blob-Storing and go directly to blob? Are there any issues? Can I use this directly from Blazor WASM?

The reason I ask would be because of the Azure.Storage.Account.ConnectionString I would need to fetch somehow (API?) encrypted and decrypt when using.

And then I need to enable CORS to the blob (having trouble finding information on that)

Access to fetch at 'https://mystuff.blob.core.windows.net/0-event-poster-images?restype=container' from origin 'https://localhost:44307' has been blocked by CORS policy: Response to preflight request doesn't pass access control check: No 'Access-Control-Allow-Origin' header is present on the requested resource. If an opaque response serves your needs, set the request's mode to 'no-cors' to fetch the resource with CORS disabled.

  • ABP Framework version: v7.0.1
  • UI type: Blazor WASM
  • DB provider: EF Core
  • Identity Server Separated: yes

2 Answer(s)
  • User Avatar
    0
    Sturla created

    First I´m trying to figure out if/how I can do this without loading files first into memory but if I get that to work it would be great to know if anybody has done anything like this here?

    I found this good answer and I think this should be possible but I need to get a SAS token and enable Cross-Origin Resource Sharing (CORS) support for Azure Storage

    Is this something that can be built into the current ABP.io Blob storage wrapper?

  • User Avatar
    0
    liangshiwei created
    Support Team Fullstack Developer

    Hi,

    Is this something that can be built into the current ABP.io Blob storage wrapper?

    We have no plan to implement this feature yet.

    For large files, it is recommended that you upload directly from the browser to the Azure Blob,

    Here are some links:

    https://techcommunity.microsoft.com/t5/apps-on-azure-blog/azure-storage-blob-upload-from-browser/ba-p/392687 https://learn.microsoft.com/en-us/azure/storage/blobs/quickstart-blobs-javascript-browser

Made with ❤️ on ABP v9.1.0-preview. Updated on December 13, 2024, 06:09