【问题标题】:File upload using react redux through API call通过 API 调用使用 react redux 上传文件
【发布时间】:2017-07-18 07:58:28
【问题描述】:

我想上传一个带有 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
}

文件信息在哪里?

【问题讨论】:

    标签: javascript reactjs express react-redux redux-form


    【解决方案1】:

    您需要一个 Express 中间件来处理多部分/表单数据,例如 Multer

    【讨论】:

      猜你喜欢
      • 2018-09-20
      • 2013-10-30
      • 1970-01-01
      • 1970-01-01
      • 2021-01-28
      • 2017-11-23
      • 2020-06-22
      • 2021-10-25
      • 2018-11-11
      相关资源
      最近更新 更多