<input type="file">

下面的代码,直接存为html,在浏览器中打开

<html>
<header></header>
<body>
<input type="file">
</body>
<footer></footer>
</html>

显示结果如下所示,

自动带有浏览按钮

https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input/file

<input> elements with type="file" let the user choose one or more files from their device storage. Once chosen, the files can be uploaded to a server using form submission, or manipulated using JavaScript code and the File API.

客户端选择文件之后,有三种方式将文件上传到服务器,

原文地址:https://www.cnblogs.com/chucklu/p/11059262.html