-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.html
32 lines (27 loc) · 895 Bytes
/
index.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>File Dialog Example</title>
</head>
<body>
<input type="file" id="fileInput" style="display: none" />
<button onclick="openFileDialog()">Open File Dialog</button>
<script>
function openFileDialog() {
const fileInput = document.getElementById("fileInput");
fileInput.click();
fileInput.addEventListener("change", handleFileSelect);
}
function handleFileSelect(event) {
const selectedFile = event.target.files[0].mozFullPath;
console.log("Selected file:", selectedFile.value);
if (selectedFile) {
console.log("Selected file:", selectedFile);
// Do something with the selected file
}
}
</script>
</body>
</html>