Lepozepo / cloudinary

MIT License
94 stars 42 forks source link

"public_id not defined" error when trying to generate downloadable link. #63

Open juancobe opened 8 years ago

juancobe commented 8 years ago

Hi, thanks for the this package :)

We're using it to upload files from a form, and generating an email with a downloadable link to the file.

The upload is working fine, but we're getting a "public_id not defined" error when using Meteor.call("c.get_download_url", public_id,ops,callback)

My cloudinary.coffee in the client:

$.cloudinary.config
cloud_name:"****"

Template.submitDesign.events
    "change input[type='file']": (e) ->
    files = e.currentTarget.files

    Cloudinary.upload files

     Meteor.call "c.get_download_url", public_id,(err,download_url) ->
            console.log "Upload Error: #{err}"
            console.log "#{download_url}"
panphora commented 7 years ago

After you upload your files to Cloudinary, you'll be able to access their public_id's in the callback response. Save this in your db so you can access it later. It's useful for doing future transformations.

Submit this public_id as the first argument to the c.get_download_url method in order to get the download link.