1
這裏是POST請求JSON
:的NodeJS上傳的base64圖像天青Blob存儲結果「ResourceNotFound」錯誤
{
"name":"images.jpg",
"file":"data:image/jpeg;base64,/9j/4AAQSkZJRgABAQAAAQABAAD/2wCEAAkGBxQTEhIUEhIUFBUV…K9rk8hCAEkjFMUYiEAI+nHIpsQh0AkisDYRTOiCAbWVtgCtI6IlkHh7LDTQXLH0EIQBj//2Q=="
}
和這裏的請求/upload
路線下我的節點控制器,我使用createBlockBlobFromText()
從azure-storage。
var azure = require('azure-storage');
var blobSvc = azure.createBlobService('myblob.blob.core.windows.net/mycontainer', THE_KEY);
controllers.upload = function (req, res, next){
var startDate = new Date();
var expiryDate = new Date(startDate);
var sharedAccessPolicy = {
AccessPolicy: {
Permissions: azure.BlobUtilities.SharedAccessPermissions.WRITE,
Start: startDate,
Expiry: expiryDate
}
};
var sharedAccessSignatureToken = blobSvc.generateSharedAccessSignature('resources', req.body.file, sharedAccessPolicy);
var sharedBlobService = azure.createBlobServiceWithSas(blobSvc.host.primaryHost + '/' + 'mycontainer' + '?' + sharedAccessSignatureToken);
sharedBlobService.createBlockBlobFromText('mycontainer', req.body.name, req.body.file, function(error, result, response) {
if (error) {
res.send(error);
return;
}
res.send(result);
});
}
但是我收到此錯誤。
{
"code": "ResourceNotFound",
"statusCode": 404,
"requestId": "bffa6099-0001-000b-53f9-80d18a000000"
}
一個明顯的問題:是否容器存在於您的存儲帳戶? –
@GauravMantri是的,它確實是100%以上。 – CENT1PEDE
@GauravMantri我把''data:image/jpeg ...「''傳遞給'createBlockBlobFromText()'函數的圖像格式是正確的嗎? – CENT1PEDE