Ответ выглядит достаточно простым, поэтому я начну реагировать:
Код: Выделить всё
getInitialState: function(){
return{file: []}
},
_onChange: function(){
// Assuming only image
var file = this.refs.file.files[0];
var reader = new FileReader();
var url = reader.readAsDataURL(file);
console.log(url) // Would see a path?
// TODO: concat files for setState
},
render: function(){
return(
{/* Only show first image, for now. */}
[img]{this.state.file[0} /[/img]
)
};
Относительно ответа:
Подробнее здесь: https://stackoverflow.com/questions/380 ... g-in-react