Last active
August 29, 2015 14:08
-
-
Save bazzel/5173956dd0d4e513c4eb to your computer and use it in GitHub Desktop.
https://github.com/bazzel/ember-workshop, tag 4.0.0
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import Ember from 'ember'; | |
export default Ember.TextField.extend({ | |
type: 'file', | |
change: function (e) { | |
var reader = new FileReader(), | |
_this = this; | |
reader.onload = function (e) { | |
var fileToUpload = e.srcElement.result; | |
Ember.run(function() { | |
_this.set('file', fileToUpload); | |
}); | |
}; | |
return reader.readAsDataURL(e.target.files[0]); | |
} | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment