Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

210
Views
how to select file and convert to string in react?

So in my backend (express and mongodb) I have a field inside of post model called picture and it's type is string. So in the frontend (React) I want the user to be able to select a file and then the file will be converted to a string then sent to the backend. I do not know how to do this nor have I been able to find any tutorial or blog on this. Thanks in advance!

about 4 years ago · Santiago Gelvez
2 answers
Answer question

0

Google "convert file to string js". Then you need to do a POST request by putting that string to the BODY in your POST request but of course you need to handle this operation in your backend in one of your endpoints.

about 4 years ago · Santiago Gelvez Report

0

The functionality you are looking for is called FileReader API.

You might take a look at a very similar question here: How to convert file to base64 in JavaScript?.

about 4 years ago · Santiago Gelvez Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!