Portfolio with meteor

#1

how i create a portfolio using meteor

#2

Maybe you could start by looking at the tutorials and example apps to get some ideas?

#3

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

#4

#5

this is the client main.js

#6

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.

4 Likes
#7

i don’t know how to expose a problem in network this is my second time very sorry

#8

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();
}
});

#9

There are no route definitions there for iron-router.
Try removing iron-router, or specifying a route definition that renders your upload form

1 Like