我想在 Reatjs 前端上传 csv 文件并将其发送回后端服务器(Spring Rest API)。
NPM has lot of things that solve this issue. Checkout react-upload-file
you could simply make a post http request with the file appended in a form data object, like this using axios (or any other lib you prefer)
const formData = new FormData();
formData.append("file", yourStateFile);
axios.post('yourUrl', formData, {
headers: {
'Content-Type': 'multipart/form-data'
}
})
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.