Viewing Uploaded image in meteor-files


I am using to upload the file.

I have “choices” collection which have each choice which containes a image each.
I have published the images file,

pub.js (server side)

Meteor.publish(‘files.images.all’, function () {
return Images.find().cursor;


{{#each choices}}
{{> choice}}



getImage(id) {
return Images.findOne({_id:id}).link();

I get Exception in template helper: getImage.

What I want is I have to display all the choices with their image & names.
I have the choices collections with data schema like
{name:“some choice”, featured_image:{ _id:“KcLkabv2wPiSwLpm6” }}
I am trying to get the link of the image by passing the ID to image collection.

How can I achieve this?
Is my approach is wrong?

I am new to meteor.


Can you give more detail about the error?

Can you put a breakpoint in your helper function and test what Images.findOne returns?

How to output the image i uploaded using Meteor-Files?

The above is the error I got.

When I console Images.findOne({_id:id}) It prints the Image object and link() prints the link too.

But when I return it shows exception.

I solved the problem,

I stored the Images.findOne({_id:id}) in a variable & returned it. It worked like charm.

My New Function here is,

  getImage(id) {
  	path = Images.findOne({_id:id}).link();
  	return path;

Finding this crazy solution took me a couple of days :smiley:
Thanks for your concern.