Put request to upload zip file to Azureblob. Response as created but No file in blob

279 Views Asked by At

I’m trying to upload zip using put request to azure url. as a result of PUT request i’m getting 201 (created) as result of request. Snaplogic Response

Here is the details i’m using to upload a file Blob Url: https://symphnytstcjgrk509.blob.core.windows.net/dmf/GHD%20Forecast%20Interface%20BY.xml?sv=2014-02-14&sr=b&sig=XXXst=2022-11-30T12%3A59%3A44Z&se=2022-11-30T13%3A34%3A44Z&sp=rw Content-Type : application/zip Upload transfer request type: Calculate content length x-ms-blob-type: BlockBlob

The same is getting successfully executed from Post man and the file is uploaded

Do you know what's happening here?

1

There are 1 best solutions below

0
On

I have uploaded the zipfile using code and able to fetch the file using postman and also using urls.

  1. Create a storage in Azure enter image description here
  2. Create a container enter image description here Code Snippet:
string connection_String = Environment.GetEnvironmentVariable("AzureWebStorage");
            string container_Name = Environment.GetEnvironmentVariable("ContainerName");
            var file = req.Form.Files["File"];
            var filecontent = file.OpenReadStream();
            var blobClient = new BlobContainerClient(connection_String, container_Name);
            var blob = blobClient.GetBlobClient(file.FileName);
            byte[] byteArray = Encoding.UTF8.GetBytes(filecontent.ToString());
            using (Stream myblob = new MemoryStream(byteArray))
            {
                await blob.UploadAsync(myblob);
            }
            return new OkObjectResult("file uploaded successfylly");

Zip File Uploaded

enter image description here

And also, able to upload and download using URLs.