I'm trying to upload different files and folders to my Google Drive. For each upload I get a success response in the callback (code 200
), meaning they were uploaded. When I request for a list of files, I also see the files I've uploaded. But when I open the drive, I can't see them there. Am I looking in the wrong place?
const {google} = require ('googleapis');
var fs = require('fs');
const credentials = require('./my-project-xxxx-1-xxxxxxxxx.json');
const scopes = ['https://www.googleapis.com/auth/drive'];
const auth = new google.auth.JWT(credentials.client_email,
null,
credentials.private_key,
scopes);
const drive = google.drive({'version': 'v3', auth});
var metaData = {'name': 'image.jpg'};
const media = {'mimeType': 'image/jpeg',
'body': fs.createReadStream('./view_image.jpg')};
drive.files.create({'resource': metaData,
'media': media,
errorHandling});
function errorHandling (err, file)
{
if (err)
{
console.log(err);
}
else
{
console.log('SUCCESS ', file);
}
}