I'm trying to upload a file to azure blob storage. I'm receiving it on the backend, but I keep getting the error createBlobFromLocalFile should be a non-empty string
I"m receiving the file as you can see in console output, but I don't understand why I can't send it to blob storage. I've tried replacing the second parameter called blob string
with req.file, req,file.path, req.file.destination + filename
, but haven't been able to get it to store the file in blob. I appreciate any help!
app.js
app.post("/api/fileupload", checkAuth, upload, (req, res, next) => {
console.log("req.file below");
console.log(req.file);
blobService.createBlockBlobFromLocalFile('testcontainer', req.file, "image.png", function (error, result, response) {
console.log(response);
if (!error) {
// file uploaded
}
});
});
Console Output
req.file below
{ fieldname: 'file',
originalname: 'blob',
encoding: '7bit',
mimetype: 'image/jpeg',
destination: 'public/uploads/',
filename: '18af517e9a94b2bdab02c7169b8b88a7',
path: 'public\\uploads\\18af517e9a94b2bdab02c7169b8b88a7',
size: 39367 }
TypeError: Parameter blob for function _createBlobFromLocalFile should be a non-empty string