Forum Discussion
Save generated .xml file to Azure, using javascript
- Jul 15, 2017
Hi Mike,
Long time no see...
Assuming you want to use Azure File Service, you could use REST operations with jQuery Ajax or fetch (browser native or polyfill).
See https://docs.microsoft.com/en-us/rest/api/storageservices/file-service-rest-api for the HTTP request format and required headers. In the case of saving a file it is a two step process:
- Create File;
- Put Range.
BTW it looks like the API description for Put Range is incomplete, because you would expect that the actual contents should be specified in the HTTP body.
There is a security tradeoff however. You have to create a shared access signature with a shared key and that key is visible when you only use client side scripting. See https://www.kongsli.net/2011/03/16/creating-azure-blob-storage-shared-access-signatures-using-javascript/ for more information.
Hi Mike,
Long time no see...
Assuming you want to use Azure File Service, you could use REST operations with jQuery Ajax or fetch (browser native or polyfill).
See https://docs.microsoft.com/en-us/rest/api/storageservices/file-service-rest-api for the HTTP request format and required headers. In the case of saving a file it is a two step process:
- Create File;
- Put Range.
BTW it looks like the API description for Put Range is incomplete, because you would expect that the actual contents should be specified in the HTTP body.
There is a security tradeoff however. You have to create a shared access signature with a shared key and that key is visible when you only use client side scripting. See https://www.kongsli.net/2011/03/16/creating-azure-blob-storage-shared-access-signatures-using-javascript/ for more information.