kitchen-examples icon indicating copy to clipboard operation
kitchen-examples copied to clipboard

Upload example is not working

Open rikyperdana opened this issue 7 years ago • 6 comments

I build an example project with example-upload.yaml, when I insert an item with a jpg file, it creates one record on gallery collection, but it stores and empty string on fileId. Is there something wrong?

rikyperdana avatar Nov 15 '16 09:11 rikyperdana

Finally worked, When the browser console says 'Reference Error event is undefined', I open the Template.events and change param 'event' to 'e' according to the parent function It gives me headache for about 2 days :D

rikyperdana avatar Nov 18 '16 15:11 rikyperdana

@rikyperdana sorry for my unresponsiveness - being busy with other things these days.

Please give me more details: is it bug in the generated code, or is bug with your custom code? If it is bug with the generator, please copy & paste part of the file, I will fix it and deploy in next version.

Thanks!

perak avatar Nov 18 '16 21:11 perak

When i run the example-upload project, and upload something, the firefox browser console says this ReferenceError: event is not defined [Learn More] I remove the whole project and rebuild it to know what's goin' on

When i run meteor-kitchen kitchen-examples/example-upload It generates a whole project with upload/client/views/home/insert/insert.js like this FS.Utility.eachFile(event, function(file) {

But when i change it with FS.Utility.eachFile(e, function(file) { It works perfectly fine :)

Just replaced param 'event' to 'e' And i think it comes from the generator itself, so i need to fix it everytime i run the generator

rikyperdana avatar Nov 23 '16 02:11 rikyperdana

@rikyperdana ok, thanks! Fixed and will be available in the next version.

perak avatar Nov 23 '16 07:11 perak

If i may add one more thing, in the example-upload/client/views/home/home.js the template.events click .delete-file function only remove the Gallery collection with callback: function() { Gallery.remove({ _id : self._id }); }

And when i run meteor mongo and run db.cfs_gridfs.files.files.find() It shows that it still contains the blocks of file i just removed before.

Can you make it so the function remove both file information document and it's gridfs blocks simultaneusly? :)

rikyperdana avatar Nov 23 '16 17:11 rikyperdana

@rikyperdana Ah... OK, I'll fix that too. 👍

perak avatar Nov 23 '16 21:11 perak