Upload Image in Meteor
Hi, Check this post, if you want to know how to upload image in metoer... JS On Client import { Template } from 'meteor/templating'; import { ReactiveVar } from 'meteor/reactive-var'; import Images from '/lib/images.collection.js'; import './main.html'; Template.uploadedFiles.helpers({ uploadedFiles: function () { return Images.find(); } }); Template.uploadForm.onCreated(function () { this.currentUpload = new ReactiveVar(false); }); Template.uploadForm.helpers({ currentUpload: function () { return Template.instance().currentUpload.get(); } }); Template.uploadForm.events({ 'change #fileInput': function (e, template) { if (e.currentTarget.files && e.currentTarget.files[0]) { // We upload only one file, in case // there was multiple files selected var file = e.currentTarget.files[0]; if (file) { var uploadInstance = Images.insert({ file: file,
Comments
Post a Comment