Maybe I'm a little late with the answer
Use predefined SAS
form data-sas . , - SAS , havent . ( )
Dropzone.options.myDropzone = {
method: "PUT",
headers: {"x-ms-blob-type": "BlockBlob"},
sending: (file, xhr) => {
const _send = xhr.send;
xhr.send = () => { _send.call(xhr, file) };
},
init: function() {
const dz = this,
action = dz.element.action,
sas = dz.element.dataset.sas;
dz.on("processing", (file) => {
dz.options.headers["Content-Type"] = file.type;
dz.options.url = `${action}/${file.name}?${sas}`;
})
},
}
Dropzones init
Dropzone.options.myDropzone = {
autoProcessQueue: false,
acceptedFiles: ".xls,.xlsx",
method: "PUT",
headers: {"x-ms-blob-type": "BlockBlob"},
sending: (file, xhr) => {
const _send = xhr.send;
xhr.send = () => { _send.call(xhr, file) };
},
init: function() {
let sas = null;
const dz = this,
xhr = new XMLHttpRequest();
xhr.addEventListener("load",
(event) => {
sas = getSasFromEvent(event);
dz.options.autoProcessQueue = true;
dz.processQueue();
}, true);
xhr.open("GET", "/get-sas");
xhr.send();
dz.on("processing", (file) => {
dz.options.headers["Content-Type"] = file.type;
dz.options.url = `${action}/${file.name}?${sas}`;
})
},
}
Dropzone , SAS asynchrouniosly
.