1

I want to upload a file from a client to the server using only react (with typescript) without JQuery. I'm not able to find any solution.

2 Answers 2

1

You can try something like this:

In your render():

<input type="file" onChange={(e) => this.handleFileUpload(e)} />

And your onChange handler:

private handleFileUpload({ files })
{
  const file = files[0];

  // send file to server here the way you need
}
Sign up to request clarification or add additional context in comments.

Comments

0

https://www.npmjs.com/package/react-firebase-file-uploader This will work for you for sure, as i also used this

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.