Autoform plus collection2 failed to upload

  node.js, question
  • packages

aldeed:collection2
 cfs:standard-packages
 cfs:gridfs
 aldeed:autoform
  • html

<template name="profile">
 {{#autoForm collection='Links' type='insert' id='insertLinksForm'}}
 <fieldset>
 {{> afQuickField name='title'}}
 {{> afQuickField name='picture'}}
 <button type="submit" class="btn btn-primary">insert</button>
 </fieldset>
 {{/autoForm}}
 </template>
  • lib/collections/images

//stores:[]
 var Images = new FS.Collection("images",{
 stores:[new FS.Store.GridFS('imagesStore',{path:'~/uploads'})]
 bracket
 
 )
 Images.allow({
 insert: function(userId, doc) {
 return true;
 },
 update: function(userId, doc, fieldNames, modifier) {
 return true;
 },
 download: function(userId) {
 return true;
 bracket
 });  `
  • lib/collection/link

Schemas = {};
 //Change meteor.Collection to Mongo.Collection because of the upgrade of Meteor version
 var Links = new Mongo.Collection('links');
 Schemas.Links = new SimpleSchema({
 title:{
 type:String,
 max:60,
 },
 picture:{
 type:String,
 autoform:{
 afFieldInput:{
 type:'fileupload',
 collection:'Images',
 Label:' Upload'
 bracket
 bracket
 
 bracket
 })
 Links.attachSchema(Schemas.Links);
 Links.allow({
 insert:function () {
 return true;
 bracket
 })
  • publication

Meteor.publish('images', function() {
 return Images.find({});
 });
 Meteor.publish('links',function () {
 return Links.find({})
 })
  • error:link is not in window scope

Ask the Great Spirit for an answer?

Images and Links cannot be preceded by var to see if it is related to this