How can the HTML5 progress element be utilized to display file upload progress without relying heavily on PHP?

When uploading files using PHP, the progress of the upload can be displayed using the HTML5 progress element. This can be achieved by utilizing JavaScript to monitor the progress of the file upload and updating the progress element accordingly. By using AJAX to send the file data to the server, the progress can be tracked without relying heavily on PHP.

<!DOCTYPE html>
<html>
<head>
    <title>File Upload Progress</title>
</head>
<body>
    <input type="file" id="fileInput">
    <progress value="0" max="100" id="progressBar"></progress>

    <script>
        document.getElementById('fileInput').addEventListener('change', function() {
            var file = this.files[0];
            var xhr = new XMLHttpRequest();
            xhr.open('POST', 'upload.php', true);

            xhr.upload.onprogress = function(e) {
                if (e.lengthComputable) {
                    var percentComplete = (e.loaded / e.total) * 100;
                    document.getElementById('progressBar').value = percentComplete;
                }
            };

            xhr.send(file);
        });
    </script>
</body>
</html>