Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

202
Visualizações
Uploading blob to Azure Storage using JS and SaS url

I'm using a combination of C# and JS to upload a file to Azure storage (using C# I create a SaS URL for the blob and JS just to upload the file through the browser). I have a problem with Blob ContentType. When I create a Blob using C# by loading string.Empty

blobClient.Upload(string.Empty, new BlobHttpHeaders()
{
    ContentDisposition = "newFile.png",
    ContentType = "image/png"
});

Everything is fine in the Azure portal, but when I upload the file using JS ("@azure/storage-blob" https://docs.microsoft.com/en-us/javascript/api/@azure/storage-blob/blockblobclient?view=azure-node-latest#@azure-storage-blob-blockblobclient-uploaddata)

await blockBlobClient.uploadData(file);

It will overwrite ContentType.

I could use

await blockBlobClient.uploadData(file, {
    blobHTTPHeaders:{
        blobContentDisposition: file.name,
        blobContentType: file.type
    }
});

But I don't want to use it in JS because anyone can write anything in Source. Is there any way to use something like Static ContentType for blob or inject in SaS ContentType (injection in BlobSasBuilder doesn't work)

about 4 years ago · Juan Pablo Isaza
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda