13 lines
368 B
CoffeeScript
13 lines
368 B
CoffeeScript
App.FormFileUploadComponent = Ember.TextField.extend
|
|
tagName: 'input'
|
|
attributeBindings: ['name']
|
|
type: 'file'
|
|
file: null,
|
|
change: (e)->
|
|
reader = new FileReader()
|
|
that = this
|
|
reader.onload = (el)->
|
|
fileToUpload = el.target.result
|
|
Ember.run -> that.set('file', fileToUpload)
|
|
reader.readAsDataURL(e.target.files[0])
|