Image upload on cloudinary using meteor

Hi, iam using “lepozepo:cloudinary” meteor package to upload files to cloudinary from meteor app. the file is not uploaded and i am not getting any error. Appreciate if someone can point me what is going wrong. the following is the code.

Template.userprofile.events({
    "change input[type='file']": function(e) {
      console.log("iam in file upload")
     files = e.currentTarget.files[0];
       console.log("fiels value" + files)
    Cloudinary.upload(files,function(err,res){
    console.log("Upload Error:"  + err); //no output on console
    console.log ("Upload Result:" + res);        
    })    
    console.log("finsied" + files)
    }    
}) 

the following is the console output.

iam in file upload
fiels value[object File]
finsied[object File]

Cloudinary.upload expects an array as the first parameter. Passing in an object won’t work as the first thing the upload function tries to do is loop over the incoming array.

1 Like

thanks for quick response, now iam getting the following error. i have configured the server side and client side. Any idea? thanks

OPTIONS https://api.cloudinary.com/v1_1/dojoin/image/upload net::ERR_INSECURE_RESPONSE
Uncaught SyntaxError: Unexpected end of input(anonymous function) @ functions.coffee:110

1 Like

No idea - I’ve seen net::ERR_INSECURE_RESPONSE errors while making ajax requests to dev sites with self-signed SSL certs before, but I’m not sure why you’re getting this from Cloudinary. I’ve checked their https://api.cloudinary.com cert and it looks okay.

1 Like

thanks willson for your effort. i will try on stackoverflow, lets see if anyone came across the same issue. thanks

1 Like

It turns out that the problem is with the google chrome browser. But in firefox its working fine. Not sure how to handle this in chrome.

It might be that you are passing an object into the string notation in your console.log()s. Try replacing your +'s with ,'s. I had this problem, and it stemmed from the fact that their examples are written in Coffeescript, and the translator I used put in pluses instead of commas.

I made an informational issue about it in their github repo a while back: https://github.com/Lepozepo/cloudinary/issues/40

edit: this probably won’t help you upload the files, but at least you should be able to display some more meaningful data from the callback to help debug

1 Like

Thanks @generalledger , actually this problem specific to the googlechrome, this is a known bug in the chrome version 47.0.2526.106 m. i think i have downgrade the version.

1 Like

Don’t know if this will help, but you can look at Telescope’s Cloudinary implementation, too: https://github.com/TelescopeJS/Telescope/tree/master/packages/telescope-cloudinary (it’s purely server-side though).

2 Likes