Lepozepo / cloudinary

MIT License
94 stars 42 forks source link

Javascript README #32

Closed sangyoo91 closed 9 years ago

sangyoo91 commented 9 years ago
Template.yourtemplate.events
    "change input[type='file']": (e) ->
        files = e.currentTarget.files

        Cloudinary.upload files,
            folder:"secret" # optional parameters described in http://cloudinary.com/documentation/upload_images#remote_upload
            (err,res) -> #optional callback, you can catch with the Cloudinary collection as well
                console.log "Upload Error: #{err}"
                console.log "Upload Result: #{res}"

``

Could you show the js version of this?
Lepozepo commented 9 years ago
Template.yourtemplate.events({
  "change input[type='file']": function(e) {
    var files;
    files = e.currentTarget.files;
    return Cloudinary.upload(files, {
      folder: "secret"
    }, function(err, res) {
      console.log("Upload Error: " + err);
      return console.log("Upload Result: " + res);
    });
  }
});