<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>File Upload and Edit</title>
</head>
<body>
<form id="[ninja_form id=3]">
</form>
<textarea id="fileContent" rows="20" cols="50"></textarea>
<button type="button" onclick="saveFile()">Save File</button>
<script>
function loadFile() {
const fileInput = document.getElementById('fileInput');
const file = fileInput.files[0];
const reader = new FileReader();
reader.onload = function(e) {
const textArea = document.getElementById('fileContent');
textArea.value = e.target.result;
};
if (file) {
reader.readAsText(file);
} else {
alert('No file selected');
}
}
function saveFile() {
const textArea = document.getElementById('fileContent');
const blob = new Blob([textArea.value], { type: 'text/plain' });
const link = document.createElement('a');
link.href = URL.createObjectURL(blob);
link.download = 'edited_file.txt';
link.click();
}
</script>
</body>
</html>