React中的文件上传
const data = new FormData(); data.append('file', this.fileInput.current.files[0]); //相当于 input:file 中的name属性 fetch('http://127.0.0.1:3001/file/upload', { method: 'POST', body: data }).then(response => console.log(response))
来源:https://segmentfault.com/a/1190000016824949?utm_source=tag-newest

浙公网安备 33010602011771号