javascript - autoform + collection2实现上传失败
大家讲道理
大家讲道理 2017-04-11 09:47:01
[JavaScript讨论组]
  • packages

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

  • lib/collections/images

//stores:[]
var Images = new FS.Collection("images",{
  stores:[new FS.Store.GridFS('imagesStore',{path:'~/uploads'})]
}

)
Images.allow({
  insert: function(userId, doc) {
    return true;
  },
  update: function(userId, doc, fieldNames, modifier) {
    return true;
  },
  download: function(userId) {
    return true;
  }
});`
  • lib/collection/link

Schemas = {};
//将Meteor.Collection改为Mongo.Collection,由于meteor版本的升级
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:'上传'
      }
    }

  }
})
Links.attachSchema(Schemas.Links);
Links.allow({
  insert:function () {
    return true;
  }
})
  • publication

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

求大神解答?

大家讲道理
大家讲道理

光阴似箭催人老,日月如移越少年。

全部回复(1)
高洛峰

Images 和 Links 前面不能用 var 看看是不是跟这个有关

热门教程
更多>
最新下载
更多>
网站特效
网站源码
网站素材
前端模板
关于我们 免责申明 举报中心 意见反馈 讲师合作 广告合作 最新更新 English
php中文网:公益在线php培训,帮助PHP学习者快速成长!
关注服务号 技术交流群
PHP中文网订阅号
每天精选资源文章推送
PHP中文网APP
随时随地碎片化学习

Copyright 2014-2025 https://www.php.cn/ All Rights Reserved | php.cn | 湘ICP备2023035733号