Just use the change event in the input. Then you can submit the form or use ajax for asynchronous output. Here is a simple example:
View
App.UploadButtonView = Ember.View.extend({
tagName: 'input',
attributeBindings: ['type'],
type: 'file',
change: function(e){
var self = this;
var formData = new FormData();
formData.append('file', this.$().get(0).files[0]);
$.ajax({
url: '/file_upload/',
type: 'POST',
success: function(data){ },
error: function(){ },
data: formData,
cache: false,
contentType: false,
processData: false
});
}
});
Template
{{view 'uploadButton'}}
Example: http://emberjs.jsbin.com/jameg/1/edit
source
share