<html>
<head>
<style>
.visually-hidden {
position: absolute !important;
height: 1px;
width: 1px;
overflow: hidden;
clip: rect(1px, 1px, 1px, 1px);
}
/* Separate rule for compatibility, :focus-within is required on modern Firefox and Chrome */
input.visually-hidden:focus+label {
outline: thin dotted;
}
input.visually-hidden:focus-within+label {
outline: thin dotted;
}
</style>
</head>
<body>
<video src="blob:http://localhost:3333/b9106407-71f5-4329-b687-197549c18196" controls="controls"></video>
<button onClick="sendFiles()">上传到服务器</button>
<hr />
<!-- 当用户选择一个文件时,handleFiles() 方法会用一个 FileList 对象作为参数被调用,FileList 对象包含表示用户选择的文件的 File 对象。如果你想让用户选择多个文件,只需在 input 元素上使用 multiple 属性: -->
<input type="file" id="input" multiple onchange="handleFiles(this)">
<hr />
<p>通过 click() 方法使用隐藏的 file input 元素</p>
<input type="file" id="fileElem" multiple accept="image/*" style="display:none" onchange="handleFiles(this.files)">
<button id="fileSelect">Select some files</button>
<hr />
<p>使用 label 元素来触发一个隐藏的 file input 元素</p>
<input type="file" id=
js上传图片视频
最新推荐文章于 2024-07-18 20:54:54 发布