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.!!!

4

1 回答 1

1
  1. 设置一个可用于保存 url 的 Session 变量: Session.setDefault('uploadedImageUrl', placeholderImageUrl)

  2. 上传图片并获得图片后,将会话变量设置为新的 url:Session.set('uploadedImageUrl', fpImageUrl)

  3. 创建一个模板助手来引用模板中的会话变量:Template.uploadform.uploadedImageUrl = -> Session.get('uploadedImageUrl')

  4. 在您的模板中,像这样显示图像:img(src="{{uploadedImageUrl}}")

上传图片后,您的占位符图片将替换为新上传的图片。

于 2014-03-09T02:27:03.063 回答