www.dextsolution.com
DEXTUPLOAD
X5
Product description > Azure Blob Storage file upload

# Azure Blob Storage file upload

Azure's Data Storage services include Blob Storage, Table Storage, Queue Storage, File Storage, and more. DEXTUploadX5 provides the ability to upload files to the Blob Storage service.

In order for the DEXTUploadX5 product to upload files to Azure Blob Storage, CORS settings must be configured for the Blob service of the account using the storage, as communication between different sources must be allowed. To use the upload and download features, you must allow the HEAD, GET, POST, PUT, and OPTIONS request methods, as well as the content-type, x-request-with, and x-ms-* request headers. When operating, be careful not to set the Allowed Origins property to the value ‘*’.

Uploading using a shared access token

  DEXTUploadX5 requires a shared access token to upload files directly to Azure Blob Storage. For security reasons, the shared access token must be generated by the backend and passed to DEXTUploadX5.

  To upload to Azure Blob Storage, set the upload mode to ‘AZRBS’ and use the setAZRBSUploadConfig method to provide the necessary configuration values.

      dx.setUploadMode("AZRBS");
      dx.setAZRBSUploadConfig({
          containerURL: "https://domain/path/get-container-url",
          sasListURL: "https://domain/path/get-list-sastoken",
          sasUploadURL: "https://domain/path/get-upload-sastoken"
      });

  In the above code, containerURL is the URL for obtaining the address of the Blob Storage container to upload to. sasListURL and sasUploadURL are URLs for obtaining shared access tokens.

  By implementing the steps to obtain the shared access token required for the upload process on the server side using the Azure Storage SDK appropriate for the platform, you can have DEXTUploadX5 handle the file upload process without exposing security information such as access keys.

  Examples are provided for Java Web Applications and ASP.NET environments to help you understand the process of obtaining a shared access token. Please refer to the provided examples for implementation.

  - For environments using Java and Maven, here's how to obtain the Azure SDK.

        <dependency>
            <groupId>com.azure</groupId>
            <artifactId>azure-storage-blob</artifactId>
            <version>12.x.x</version>
        </dependency>

  - How to obtain the Azure SDK in a Java and Gradle environment

        implementation 'com.azure:azure-storage-blob:12.x.x'

  - How to obtain the Azure Storage SDK in an ASP.NET environment

    By installing the Azure.Storage.Blobs package using the NuGet package manager, you can obtain Azure.Identity.dll, Azure.Storage.Blobs.dll, Azure.Storage.Common.dll, and netstandard.dll.

  Files uploaded to a bucket are distinguished by their Blob names. While Blob names typically use the file name, to prevent overwriting issues between files with the same name, it is necessary to make the Blob name more specific. By default, the product uses the file name as the Blob name. To set the Blob name to a format other than the file name, configure the makeKey property with a function that generates the Blob name. Here, the Key and Blob name are used interchangeably.

      dx.setAZRBSUploadConfig({
          ...
          // Blob name: component-name/file-name
          makeKey: item => `${item.controlId}/${item.name}`
      });

  Azure Blob Storage allows you to separate files as if they had a folder structure by inserting the ‘/’ character into the blob name, similar to Amazon S3.

Features
  - DEXTUploadX5 uses the multipart upload method supported by the Azure Blob Storage service, enabling large file uploads.
  - The resume upload feature is only valid for up to 7 days. Uncommitted Blob blocks are retained for up to 7 days.
  - When uploading large files, you may need to change the chunkSize value.
  - When uploading files to Azure Blob Storage, the progress rate displayed in the progress window may not be as smooth as other upload methods.
  - Metadata is also uploaded, but the values are encoded in BASE64.