0

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={{action "upload"}}
    accept="image/png,image/jpeg,application/pdf"
    type="file"
    />
</script>
<script type="text/x-handlebars" id="upload">
    {{picture-upload upload='upload'}}
    {{outlet}}
</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!

Community
  • 1
  • 1
squareCircle
  • 192
  • 1
  • 13

1 Answers1

0

In PictureUploadComponent

upload(event){
      //i want to send file but this is not good value
      this.sendAction('upload',event);
    }
Ember Freak
  • 12,918
  • 4
  • 24
  • 54