Meteor: Cloudinary

后端 未结 3 1535
别那么骄傲
别那么骄傲 2021-01-01 04:22

I am trying to upload a photo with Lepozepo/cloudinary

This is my server and client config

server:

Cloudinary.config({
  cl         


        
相关标签:
3条回答
  • 2021-01-01 04:28

    Please use "_upload_file" instead of "upload". "_upload_file" is used in "upload" actually. But somehow you can not catch err and response when you use "upload"

    You can catch err and response.

    Meteor Version : 1.1.0.3

    lepozepo:cloudinary : 1.0.2

    Cloudinary._upload_file(files[0], {}, function(err, res) {
      if (err){
        console.log(err);
        return;
      }
      console.log(res);
    });
    
    0 讨论(0)
  • 2021-01-01 04:46

    I'll patch this in the source right now to accept single files as well. But yes, the Cloudinary.upload function expects Cloudinary.upload(files) and not Cloudinary.upload(files[n])

    0 讨论(0)
  • 2021-01-01 04:51

    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];
      files.push(file)
      console.log(files)
      

    And it work fine

    0 讨论(0)
提交回复
热议问题