svrcekmichal / redux-axios-middleware

Redux middleware for fetching data with axios HTTP client
MIT License
920 stars 96 forks source link

Uploading file using redux-axios-middleware #49

Closed panigrah closed 7 years ago

panigrah commented 7 years ago

How do I upload a file using this middleware and also track upload progress? Does anybody have an example?

mikhail-softgrad commented 7 years ago

I have example for uploading file. There is my action for sending file to API

const addFile = createAction(ActionTypes.FILE_ADD, fileInfo => ({
  request : {
    method: 'post',
    url:'/files',
    headers: {
      'content-type': 'multipart/form-data'
    },
    data: fileInfo
  }
}));