function previewImage(event) {
    var input = event.target;
    var reader = new FileReader();

    reader.onload = function () {
        var previewImg = document.getElementById("preview-img");

        previewImg.src = reader.result;
    };

    if (input.files && input.files[0]) {
        reader.readAsDataURL(input.files[0]);
    }
}
