psy2 / j_upl_json.html
DmitrMakeev's picture
Update j_upl_json.html
8ad5917 verified
raw
history blame
2.26 kB
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Upload JSON</title>
<style>
body {
font-family: Arial, sans-serif;
margin: 20px;
}
h1 {
color: #333;
}
form {
display: flex;
flex-direction: column;
}
label, input {
margin-bottom: 10px;
}
input[type="submit"] {
width: 150px;
padding: 10px;
background-color: #007BFF;
color: white;
border: none;
cursor: pointer;
}
input[type="submit"]:hover {
background-color: #0056b3;
}
</style>
</head>
<body>
<h1>Upload JSON Data</h1>
<form id="json-upload-form" enctype="multipart/form-data" method="post" action="/j_upload_json">
<input type="file" name="file" accept=".json" id="json-file-input">
<br><br>
<label for="verify_phone">Verify Phone Number:</label>
<input type="checkbox" id="verify_phone" name="verify_phone" value="1">
<br>
<label for="add_curator">Add Curator:</label>
<input type="checkbox" id="add_curator" name="add_curator" value="1">
<br><br>
<input type="submit" value="Upload JSON">
</form>
<script>
document.getElementById('json-file-input').addEventListener('change', function(event) {
const file = event.target.files[0];
if (file) {
const reader = new FileReader();
reader.onload = function(e) {
console.log('JSON File Content:', e.target.result);
};
reader.readAsText(file);
}
});
document.getElementById('json-upload-form').addEventListener('submit', function(event) {
const file = document.getElementById('json-file-input').files[0];
if (file) {
const reader = new FileReader();
reader.onload = function(e) {
console.log('JSON File Content on Submit:', e.target.result);
};
reader.readAsText(file);
}
});
</script>
</body>
</html>