How to update photo of this cover from my computer with javascript, button input type="file" or with nodejs.
To update the image in real time you can try:
function showThumbnail(filess) {
var url = filess.value;
var ext = url.substring(url.lastIndexOf('.') + 1).toLowerCase();
if (filess.files && filess.files[0]&& (ext == "gif" || ext == "png" || ext == "jpeg" || ext == "jpg")) {
var reader = new FileReader();
reader.onload = function (e) {
document.getElementById('fotoCapa').setAttribute('src', e.target.result);
}
reader.readAsDataURL(filess.files[0]);
}
}
<input type="file" id="upload" onchange="showThumbnail(this);"/>
<div class="imagem">
<img id="fotoCapa" src="https://return-true.com/wp-content/uploads/2013/06/jquery-tabs-html5-history.png"></div>
Ifyouwanttosavethisimageyoucanuseajaxorsubmitasaform.
RegardingpureJavaScriptajaxthissitehasacompleteexample: SITE >