cmather / meteor-file

Meteor file uploading and saving
59 stars 26 forks source link

Duplications #2

Open SergeC opened 11 years ago

SergeC commented 11 years ago

Hi. I've just installed this package, added template from "File Uploader Part 9: Build a UI Component" article, but in console I getting error "Uncaught Error: There is already a helper 'FileUploader' evaluate.js:70". If I rename "FileUploader" helper, I get another error "Uncaught Error: There is already a helper 'humanize' evaluate.js:70 Handlebars.registerHelper evaluate.js:70 (anonymous function) newDeal.js:163 (anonymous function) newDeal.js:168"

newDeal.js:163: Handlebars.registerHelper('humanize', function (number, options) {

newDeal.js:168: }).call(this); //this added by Meteor

Please check it out and let me know results. Thanks.

cmather commented 11 years ago

Hi @SergeC, Those functions were added to the package in the file uploader file. Are you duplicating the logic? If you were following along in the videos, I was showing my steps to building up the controls, but the final code is in the package itself. So you don't need to create a humanize or FileUploader handlebars helper.

SergeC commented 11 years ago

OK, now I have installed package and html template. When I try to upload something I get an error: "Name Size Upload Progress Status hma.pl 1452 0% Error: Method not found [404]"

Console log is empty.

Thanks.

SergeC commented 11 years ago

Added new file on the server side with code: Meteor.methods({ uploadFile: function(file){ file.save('./public/'); } });

Now all is OK.

I think it's reasonable to add beforeUpload method to process files before upload (compress, resize images etc.) and afterUpload method to save files with unique filenames.

Another question. How can I allow to upload only jpg and png files? How to save files on server with unique filenames?

Thanks.

EnchanterIO commented 11 years ago

@SergeC aaah i was missing the server side code now it works great! Thx BTW: i am going to use this package for image upload so when i will be done i will show you the code.