Код: Выделить всё
uploadFileToAzure: function () {
var fileToBeUploaded = UPLOAD.DESTINATION_FILE_CONFIGURATION;
if (fileToBeUploaded != null && fileToBeUploaded.length > 0) {
$.each(fileToBeUploaded, function (index, value) {
const container = new azblob.ContainerURL(value.Url, azblob.StorageURL.newPipeline(new azblob.AnonymousCredential));
try {
UPLOAD.log('sendFile');
$('form :input').attr('disabled', true);
const blobOptions = {
blobHTTPHeaders: { blobContentType: value.ContentType },
};
const blockBlobURL = azblob.BlockBlobURL.fromContainerURL(container, value.Key);
var result = azblob.uploadBrowserDataToBlockBlob(
azblob.Aborter.none, value, blockBlobURL, blobOptions);
result.then(function (result) {
alert("Done");
return true;
}, function (err) {
alert("Error");
console.log(err);
return false;
});
} catch (error) {
alert(error);
return false;
}
});
}
}
Код: Выделить всё
fileToBeUploaded[0]
e {id: 'o_1frjmofms1afu1ii2u4pc0c12kdj', name: 'Sample.ppt', type: 'application/vnd.ms-powerpoint', relativePath: '', size: 85504, …}
completeTimestamp: 0
destroy: ƒ ()
getNative: ƒ ()
getSource: ƒ ()
id: "o_1frjmofms1afu1ii2u4pc0c12kdj"
lastModifiedDate: Fri Oct 29 2021 12:34:13 GMT+0530 (India Standard Time) {}
loaded: 0
name: "Sample.ppt"
origSize: 85504
percent: 0
relativePath: ""
size: 85504
status: 1
type: "application/vnd.ms-powerpoint"
[[Prototype]]: Object
Код: Выделить всё
fileToBeUploaded2[0]
{Policy: null, Signature: null, Bucket: null, Key: 'xxxx/xxxx/xxxx/xxxxx/a67d27a4-b50c-40de-9818-bc5d5bb37b08.pdf', FileName: 'pdf-sample.pdf', …}
AccessKey: null
Acl: null
AmzAlgorithm: null
AmzCredentials: null
AmzDate: null
Bucket: null
ContentType: "application/pdf"
ExternalId: "2939"
FileName: "pdf-sample.pdf"
Key: "xxx/xxx/xxx/xxxx/a67d27a4-b50c-40de-9818-bc5d5bb37b08.pdf"
MediaUrl: null
ModuleId: 0
Policy: null
Signature: null
Type: 0
Url: "https://xxxxxx.blob.core.windows.net/xxxxxx?sv=2020-08-04&se=2022-02-12T07%3A14%3A34Z&sr=c&sp=w&sig=xxxxx"
UserAgent: null
size: 22260
[[Prototype]]: Object
Подробнее здесь: https://stackoverflow.com/questions/710 ... i-am-using