Witam!
Mam taki kod
<div class="form-group" style="text-align: center"><label style="display: block" for="avatar"><img src="http://www.ukm.my/portal/wp-content/plugins/all-in-one-seo-pack/images/default-user-image.png" style="-moz-border-radius: 50px;border-radius: 50px;height: 80px" id="imgupload"></label>
<div class="col-md-6">
<input type="file" class="form-control" name="avatar" id="avatar" style="display: none">
</div>
</div>
<div id="ok">hej</div>
<script type="text/javascript">
function readFile() {
if (this.files && this.files[0]) {
var FR= new FileReader();
FR.onload = function(e) {
document.getElementById("imgupload").src = e.target.result;
FR.readAsDataURL( this.files[0] );
}
}
document.getElementById("avatar").addEventListener("change", readFile, false);
</script>
Potrzebuje do niego dodać możliwość uploadu, od razu po wyborze, ale nie umiem sobie poradzić, bardzo proszę o pomoc. Pozdrawiam!