I am having a few issues with the Google Drive node.js library. I am trying to upload a picture to my google drive, I have authenticated previously hence the 'oauth2Client' object. This is taken nearly like for like from the example on the google docs.
var service = googleApi.drive('v3');
var fileMetadata = {
'name': 'jpeg-home.jpg'
};
var media = {
mimeType: 'image/jpeg',
body: fs.createReadStream('./temp/downloads/jpeg-home.jpg')
};
service.files.create({
auth: oauth2Client,
resource: fileMetadata,
media: media,
fields: 'id'
}, function (err, file) {
if (err) {
console.error(err);
return false;
} else {
console.log('File Id: ', file.id);
return true;
}
});
The response I am getting is an error of:
Error: Invalid multipart request with 0 mime parts.
I have done some searching and couldn't find anything so any help would be appreciated. Cheers in advance.