jeudi 26 janvier 2017

Send file to Ember controller

In ember index.html i use component to send action and get file

<script type="text/x-handlebars" id="components/picture-upload">
    <input multiple="true" onchange=
    accept="image/png,image/jpeg,application/pdf"
    type="file"
    />
</script>
<script type="text/x-handlebars" id="upload">
    
    
</script>

and in app.js

App.UploadController=Ember.Controller.extend({
  actions:{
    upload:function (event) {
     //here to get file
  }
}});

App.PictureUploadComponent=Ember.Component.extend({
  actions:{
    upload(){
      //i want to send file but this is not good value
      this.sendAction('upload',this);
    }
  }
});

but i don't know how to send event, i need something like this answer,after that i want with ajax to send file to server,but problem is how to get file!




Aucun commentaire:

Enregistrer un commentaire