Jose Osorio Jose Osorio - 1 year ago 138
HTML Question

Meteor: Cloudinary

I am trying to upload a photo with Lepozepo/cloudinary

This is my server and client config


cloud_name: '*****',
api_key: '******',
api_secret: '********'


cloud_name: "*******"

I tried to upload the image with a form

html form code:

<input type="file" id="userimage" name="userimage"/>
<button type="submit">Upload</button>

And this is my this is the event for the template{
// Submit signup form event
'submit form': function(e, t){
// Prevent default actions

var file = $('#userimage')[0].files[0];
Cloudinary.upload(file, function(err, res) {
console.log("Upload Error: " + err);
console.log("Upload Result: " + res);

When i click on upload button nothing happen, I just got an error

error: uncaught TypeError: Failed to execute 'readAsDataURL' on `'FileReader': parameter 1 is not of type 'Blob'.`

What can I do to make this work ?

Answer Source

I find a way to solved it.

  1. Lepozepo/cloudinary Cloudinary.upload method file parameter is an array, I just add this code:

    var files = []
    var file = $('#userimage')[0].files[0];

And it work fine