kitchen-examples
kitchen-examples copied to clipboard
Upload example is not working
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?
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 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!
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 ok, thanks! Fixed and will be available in the next version.
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 Ah... OK, I'll fix that too. 👍