Uploading image with a form in meteor on form submit -


i'm trying create simple web app ask user fill out few questions , upload photo. i'd of information stored in meteor collection when submit button pressed, i'm having difficulty fs collection package.

here relevant main.html:

    <form class="photoform">     problem: <input type = "text" id = "problem" placeholder="page # problem #"><br><br>     group members <input type = "text" id="group" size="50"> <br><br>     questions , comments problem: <br><br>     <textarea name="comments" form="photo" rows="4" cols="70" placeholder="enter text here..."></textarea>     <br>      upload snapshot of work here: <input type = "file" id = "myfileinput">     <br /><br />      <input type="submit" value="submit" />     </form> 

here's main.js:

template.form.events({  'click input[type=submit]': function(event, template) {  console.log("form submit") event.preventdefault();  fs.utility.eachfile(event, function(file) {     images.insert(file, function (err, fileobj){     //inserted new doc id fileobj._id, , kicked off data upload using http   });  });  }    }); 

here questions:

  1. i can file upload on event 'change .myfileinput'. i've tried upload on 'click input[type=submit]' , 'submit' , doesn't upload file. there way upload file when submit button clicked?

  2. how add data various text fields image collection? can incorporate these additions images.insert() command?

check autoform package

autoform package

and cfs autoform package cfs autoform

these packages helpful


Comments