Files
WingetRepoServer/html/up.html

34 lines
1.0 KiB
HTML

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>File Upload</title>
<link href="mod.css" rel="stylesheet" type="text/css">
<script src="script.js"></script>
</head>
<body>
<!-- <div> -->
<form action="/upload" method="post" enctype="multipart/form-data">
<input type="text" name="filename" placeholder="Selected file" readonly>
<input type="file" name="file" id="file" onchange="document.forms[0].filename.value = this.files[0].name">
<button class="btn" type="submit">Upload</button>
</form>
<!---
</div>
-->
<script>
// Ensure the file input is not empty before submitting the form
document.forms[0].addEventListener('submit', function(event) {
var fileInput = document.getElementById('file');
if (fileInput.files.length === 0) {
alert('Please select a file to upload.');
event.preventDefault();
}
});
</script>
</body>
</html>