Mani
Mani

Reputation: 23

how to upload file to azure blob with original file name using Fine Uploader

I'm uploading a file named my-image.jpg into my blob container with the endpoint of https://myaccount.blob.core.windows.net/my-container on Azure.

After than it calls signature endpoint for SaS token and generate PUT request to Azure blob. Here i observed that PUT request does not contain original file name instead of that some GUID replaced file name.

I want my original file name to be there in the PUT request so that the file will be uploaded on blob with the original name.

Would then https://myaccount.blob.core.windows.net/my-container/89056c3d-7bb3-my-image.jpg be the bloburi I send to my API while requesting a SAAS?

How do i achieve this ?

When my request hits my backend API to get a SAS, the blobUri comes in as /server/upload/some-guid-value.txt. I'm using the following options when instantiating an uploader. What am I doing wrong?

const uploader = new qq.azure.FineUploader({
        element: document.getElementById('fine-uploader-manual-trigger'),
        template: 'qq-template-manual-trigger',
        request: {
            endpoint: 'https://myaccount.blob.core.windows.net/my-container',

        },
        signature: {
            endpoint: 'http://localhost:4879/api/getsas',
            cors:{
                expected: true,
                sendCredentials: false
            },
        }
})

Upvotes: 0

Views: 1606

Answers (1)

Joey Cai
Joey Cai

Reputation: 20127

By default, File Uploader azure will use a UUID to name your object. In almost cases, this is the safest behavior.

If you change this value, you will run the risk of overwriting existing files with new ones in the event of a name collision.

If you must save the blob in azure using a different name, you could modify the blobProperties.name option appropriately.

A value of "filename" will save the object using the original filename.

For more detail, you could read about this option.

Upvotes: 2

Related Questions