reader = new FileReader();
            reader.onload = function(e) {
                previewImage.src = e.target.result;
                photoPreview.style.display = 'block';
            };
            reader.readAsDataURL(file);
        } else {
            selectedFile.style.display = 'none';
            photoPreview.style.display = 'none';
        }
    });

    function refreshCaptcha() {
        // Reload the page to get a new CAPTCHA
        window.location.reload();
    }

    // Form submission
    