Answers for "Uploading profile pic with react.js node.js express.js REST API to sqlite DB"

0

Uploading profile pic with react.js node.js express.js REST API to sqlite DB

handleSubmit = e => {
    e.preventDefault();
    const formData = new FormData();
    formData.append('name', this.state.name);
    formData.append('nickname', this.state.nickname);
    formData.append('profileImg', this.state.profileImg);

    axios
      .post(`${process.env.API_URL}/player`, formData, {
        headers: {
          Accept: 'application/json',
          'Content-Type': 'multipart/form-data'
        }
      })
      .then(() => this.props.onCreate())
      .catch(err => console.log(err));
  };
Posted by: Guest on September-25-2021

Code answers related to "Javascript"

Browse Popular Code Answers by Language