Closed ipungg-junior closed 4 weeks ago
When img canceledd, loading must be stopped, and field input img must be clear
Here is new code modal/upload_product.html
imageInputProduct.addEventListener('change', function (event) { const file = event.target.files[0]; const maxSize = 8 * 1024 * 1024; // 8MB. if (file) { if (file.size > maxSize) { alert('Ukuran file tidak boleh lebih dari 8MB.'); file.value = ''; imageInputProduct.value = ''; loadingProduct.hidden = true; } else { loadingProduct.hidden = false; const reader = new FileReader(); reader.onload = function (e) { imagePreviewProduct.src = e.target.result; imagePreviewProduct.hidden = false; }; reader.readAsDataURL(file); imageInputProduct.hidden = true; loadingProduct.hidden = true; } } });
When img canceledd, loading must be stopped, and field input img must be clear
Here is new code modal/upload_product.html