How to upload files using React?

前端 未结 2 932
刺人心
刺人心 2020-12-19 09:18

so currently I am trying to upload a file, and save it on the Google Clouds. But I am stuck at how to get the input file using React-Redux.

Basically, my back-end pa

2条回答
  •  攒了一身酷
    2020-12-19 09:52

    You cant handle onChange file by method

    handleChangeFile(event) {
      const file = event.target.files[0];
      let formData = new FormData();
      formData.append('file', file);
      //Make a request to server and send formData
    }
    

提交回复
热议问题