0

I'm trying to use the Put Blob Rest API from Postman (at the moment) using also a code generated SAS. If I set the body as binary in postman and I select my file everything works just fine - I get my file in the blob storage as expected. However, if I send the file using a multipart/form-data the file is being uploaded, but I get additional data at the beginning of the file such as: ----------------------------515848534032814231487294 Content-Disposition: form-data; name="file"; filename="my_file.json" Content-Type: application/json

Does anybody know why is that and how I could use multipart/form-data for uploading my file to the blob storage?

Thank you in advance!

0

1 Answer 1

1

This is the expected behavior when using multipart/form-data.

By using multipart/form-data, the boundary(like this ---515848534032814231487294) is auto-generated in the file. But the blob storage backend does not get rid of it(means remove these lines auto-generated).

And one more thing, multipart/form-data is mostly used in a web project, and you can write a function which is used to processing these extra lines in the backend.

Sign up to request clarification or add additional context in comments.

4 Comments

I'm already having a few clients (mobile and desktop apps) that currently upload files to a Google Bucket by doing a POST and using a multipart/form-data for the file. I want to switch to Azure blob storage and keep the clients untouched if possible (for switching the method from POST to PUT and setting the blob storage specific headers I'm using the Api Management layer) - which seems to work fine so far...
@AndreiC,for google Bucket, I think it supports auto-parse it in the background. But for blob storage, it does not support it in background. But anyway, I will check it with the storage team, and update you if any feedback.
@AndreiC, I just confirmed with storage team, the reason is that azure storage will not change or add some content to the blob file. So when use multipart/form-data via postman(or other tools like Insomnia rest client), by default the tool will add these kinds of boundary; when it uploaded to azure storage, azure storage keeps the format. Hope this can help you.
and the blob storage is usually used for binary data, so you'd better select binary instead of multipart/form-data.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.