I have html form for creating new product with image, so after choosing product image my html form submit button will become disabled. I've wrote file input action in javascript.
Here my html form code (piece of code):
<form>
<div class="form-group alert-up-pd">
<div class="small-12 large-4 columns">
<label for="">Добавить изображение</label>
<div class="containers">
<div class="imageWrapper">
<img class="image" src=""></div>
</div>
<span class="file-upload">
<input type="file" name="img" class="file-input">
Выбрать
</span>
</div>
</div>
</div>
</form>
And here is javascript code:
$('.file-input').change(function(e){
var curElement = $('.image');
var reader = new FileReader();
reader.onload = function (e) {
curElement.attr('src', e.target.result);
};
reader.readAsDataURL(this.files[0]);
});
If you need more info pls ask...