SOURCE

console 命令行工具 X clear

                    
>
console
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>选择文件</title>
</head>
<body>
    <input type="file" id="fileInput" style="display: none;" />
    <button onclick="document.getElementById('fileInput').click();">选择文件</button>

    <script>
        document.getElementById('fileInput').addEventListener('change', function(event) {
            const file = event.target.files[0];
            if (file) {
                console.log('选择的文件:', file.name);
                // You can also use URL.createObjectURL(file) to create a URL for the selected file
            } else {
                console.log('没有选择的文件');
            }
        });
    </script>
</body>
</html>