我想上传一个带有 react-redux-universal-hot-example 的文件样板文件。
提交时,将调用以下函数(由 ApiClient 管理):
export function update(data) {
return {
types: [UPLOAD, UPLOAD_SUCCESS, UPLOAD_FAIL],
promise: (client) => client.post('/project/update', {
files: data
})
};
}
在服务器端,调用以下函数(由 Api 管理):
export default function update(req, params) {
// get the file
}
文件信息位于哪里?
最佳答案
您需要一个 Express 中间件来处理多部分/表单数据,例如 Multer .
关于javascript - 通过API调用使用react redux进行文件上传,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/42490255/