如何使用Reactjs动态更改文件对象文件名。我得到了这个输出
File { name: "1.png", lastModified: 1551538633710, webkitRelativePath: "", size: 6849, type: "image/png" }
example:1.png更改2.png
class file extends Component {
constructor() {
this.submitFile = this.submitFile.bind(this);
}
submitFile = (event) => {
var file = event.target.files[0];
console.log(file)
}
render() {
return ( < input label = 'upload file' type = 'file' onChange = { this.submitFile}/>)
}
}