input输入框拿文件内容
这是html里input框
input id=“image” type=“file” name=“image”>
js内容
script>
var image = document.getElementById(‘image’).files[0];
/script>
document.getElementById(‘image’).files[0]里边存的是一个image对象,如下格式
lastModifiedDate: Sat Apr 03 2021 21:19:37 GMT+0800 (澳大利亚西部标准时间) {}
name: “运算符.png”
size: 61685
type: “image/png”
webkitRelativePath: “”
这时候如果只需要文件名字就.files[0].name,其他同理