0

I just use Filepicker to upload the picture. After I uploaded the picture I can get the url in the console.

 Template.uploadform.events
  'change #upload_widget': (evt) ->
    if console?
      console.log JSON.stringify(evt.fpfile)

Now I need to show that images to my web application by those url. I am just a new bie on meteor. I am using jade-handlebars and coffeescript in my application. Pleas help me out how can I show the images by using that url in my application ???

Thank You in advance.!!!

Bhim Prasad Ale
  • 523
  • 1
  • 8
  • 31
  • 2
    The eventedmind.com episodes on file uploading might be useful to you. It starts here: https://www.eventedmind.com/posts/html5-introducing-the-file-api. It sounds like you're not trying to upload, but instead get a data-url you can use to show the image right away. The video above will still be helpful, but just readAsDataUrl instead of binary. – cmather Aug 04 '13 at 06:19

1 Answers1

1
  1. Set a Session variable you can use to hold the url: Session.setDefault('uploadedImageUrl', placeholderImageUrl)

  2. Once the image has been uploaded and you have it, set the session variable to the new url: Session.set('uploadedImageUrl', fpImageUrl)

  3. Make a template helper to reference the session variable in your template: Template.uploadform.uploadedImageUrl = -> Session.get('uploadedImageUrl')

  4. In your template, show the image like so: img(src="{{uploadedImageUrl}}")

Once the image has been uploaded, your placeholder image will be replaced with the new uploaded image.

georgedyer
  • 2,737
  • 1
  • 21
  • 25