pyUpload/app/template.html

94 lines
2.9 KiB
HTML
Raw Permalink Normal View History

2025-03-12 22:21:30 +01:00
<!DOCTYPE html>
<html lang="de">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="theme-color" content="#007bff">
<meta name="robots" content="noindex, nofollow">
<title>File Upload</title>
<style>
body {
display: flex;
justify-content: center;
align-items: center;
height: 100vh;
background-color: #f4f4f4;
font-family: Arial, sans-serif;
}
.upload-container {
background: white;
padding: 20px;
border-radius: 8px;
box-shadow: 0px 0px 10px rgba(0, 0, 0, 0.1);
text-align: center;
}
input[type="file"] {
display: none;
}
.custom-file-upload {
display: inline-block;
background-color: #007bff;
color: white;
padding: 10px 20px;
border-radius: 5px;
cursor: pointer;
font-size: 16px;
}
.custom-file-upload:hover {
background-color: #0056b3;
}
#file-name {
display: block;
margin-top: 10px;
font-size: 14px;
color: #555;
}
button {
background-color: #28a745;
color: white;
border: none;
padding: 10px 20px;
cursor: pointer;
border-radius: 5px;
font-size: 16px;
margin-top: 10px;
}
button:disabled {
background-color: #cccccc;
cursor: not-allowed;
}
button:hover:not(:disabled) {
background-color: #218838;
}
</style>
</head>
<body>
<div class="upload-container">
<h2>Datei-Upload</h2>
<form enctype="multipart/form-data" method="post" onsubmit="disableButton()">
<label for="file-upload" class="custom-file-upload">Datei auswählen</label>
<input id="file-upload" type="file" name="file" multiple onchange="updateFileName()">
<span id="file-name">Keine Datei ausgewählt</span>
<button id="upload-button" type="submit">Hochladen</button>
</form>
</div>
<script>
function updateFileName() {
const input = document.getElementById("file-upload");
const fileNameDisplay = document.getElementById("file-name");
if (input.files.length > 0) {
fileNameDisplay.textContent = Array.from(input.files).map(file => file.name).join(", ");
} else {
fileNameDisplay.textContent = "Keine Datei ausgewählt";
}
}
function disableButton() {
document.getElementById("upload-button").disabled = true;
}
</script>
</body>
</html>