how i create a portfolio using meteor
i started by creating todos app and she was worked successful,and now i want to create a portfolio, i tried but some error blocked me
First off screen shots of code are highly unhelpful since 1. They have a limited area and require enlarging multiple images possibly back and forth between them to get a better understanding of your code, and 2. If we do spot an issue we canât just copy and paste your code to make changes.
Basically what I see here is that you have iron:router installed but no routes configured. Also as a side note it looks like you are importing âImagesâ on line 4 and then redefining it on line 8 which will throw an error. I highly suggest eslint to catch these types of errors.
i donât know how to expose a problem in network this is my second time very sorry
import { Template } from âmeteor/templatingâ;
import { ReactiveVar } from âmeteor/reactive-varâ;
import { FilesCollection } from âmeteor/ostrio:filesâ;
import { Images } from â/imports/api/imagesâ;
import â./main.htmlâ;
const Images = new FilesCollection({
collectionName: âImagesâ,
allowClientCode: false,
onBeforeUpload(file){
if(file <=10485760 && /png|jpg|jpeg/i.test(file.extention)){
return true
} else {
return âplease upload image, with size equal or less than 10MBâ;
}
}
});
if(Meteor.isClient){
Meteor.subscribe(âfiles.images.allâ);
}
if(Meteor.isServer){
Meteor.publish(âfiles.images.allâ, function(){
return Images.find().cursor;
});
}
Template.uploadForm.onCreated(function(){
this.currentUpload = new ReactiveVar(false);
});
Template.uploadForm.events({
âchange #fileInputâ(e,template){
if(e.currentTarget.files && e.currentTarget.files[0]){
const upload = Images.insert({
file: e.currentTarget.files[0],
streams: âdynamicâ,
cunckSize: âdynamicâ
}, false);
upload.on('start', function(){
template.currentUpload.set(this);
});
upload.on('end', function(error, fileObj){
if (error) {
alert('Error during upload: ' + error);
} else {
alert('File "' + fileObj.name + '" successfully uploaded');
}
template.currentUpload.set(false);
});
upload.start();
}
}
});
Template.file.helpers({
imageFile() {
return Images.findOne();
}
});
There are no route definitions there for iron-router.
Try removing iron-router, or specifying a route definition that renders your upload form