BT101
BT101

Reputation: 3836

Unable to complete uploading video to cloudinary from nodeJS

I execute this code:

var path = __dirname + '\\videos\\example.webm';
console.log(path);
cloudinary.uploader.upload(path, { resource_type: "video" }, function(success, err) {
    console.log('suc: ' + success);
    console.log('err: ' + err)
});

the behaviour is that it console log correct path to 800KB .webm file

C:\Users\Borys\Documents\igt\desktopApp\videos\example.webm

img

and then nothing happen. It doesn't console log any more info. I don't get any errors.

I'm correctly requring cloudinary classes and I'm correctly setting config (before above code)

const cloudinary = require('cloudinary');

cloudinary.config({
    cloud_name: 'myappname',
    api_key: 'my keys',
    api_secret: 'my keys'
});

Why nothing happen?

Upvotes: 0

Views: 557

Answers (1)

pushkin
pushkin

Reputation: 10209

Your call looks like this:

cloudinary.uploader.upload(path, options, callback);

which is incorrect.

Looking here, callback should be the second argument, not the third. If you need to pass in additional options into that function, you must use this call instead:

cloudinary.v2.uploader.upload(path, options, callback);

Notice the v2 in the method chain.

Upvotes: 1

Related Questions