 new Error('Network response was not ok');
        }
        return response.text();
      })
      .then(data => {
        alert('File saved successfully.');
      })
      .catch(error => {
        console.error('Error saving the file:', error);
        alert('Failed to save the file.');
      });
    }
  </script>
</body>
</html>
