I am using Azure JS library to upload blobs. Below is the code that I wrote.
var speedSummary = blobService.createBlockBlobFromBrowserFile(container, fileList[i]["FileID"], selectedFiles[i], options, function (error, result, response) {
finishedOrError = true;
if (error) {
//Handle errors in upload
console.log(error);
alert("upload failed for " + selectedFiles[i].name);
} else {
//Handle success
//Trigger postback to save the file list to database.
uploadedFiles++;
triggerPostBack(uploadedFiles);
}
});
This code was working fine till last week because I tested it. Now, it fails every time with the error "Invalid HTML File Object".
I tried to debug through the azure js library and found the place where the error is occurring.
if (!azureutil.isBrowser() ||
!browserFile ||
!browserFile.constructor ||
(!azureutil.isIE() && !browserFile.constructor.name) ||
(!azureutil.isIE() && browserFile.constructor.name !== 'File' && browserFile.constructor.name !== 'Blob') ||
!azureutil.objectIsInt(browserFile.size)) {
return fail(new ArgumentError('type', 'Invalid HTML File object.'));
} else {
callback();
return true;
}
For some reason, this condition is failing all the time. I tried disabling this condition, and then in later part of the azure js library, I received another error saying "slice is not a function" during the chunking process.
I have no idea why this code is suddenly failing, given that it was working fine till the weekend. I checked the file lists, and they seem to be proper file objects with all relevant properties.