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

229
Views
How to read uploaded text file and replace string in the file in ReactJS

replace the string "$E Between $F" with BOLD Between

 import React, { useState } from "react";
>     
>     export function Upload({ children }) {   const [files, setFiles] = useState("");
>     
>       const handleChange = e => {
>         const fileReader = new FileReader();
>         fileReader.readAsText(e.target.files[0], "UTF-8");
>         fileReader.onload = e => {
>           console.log("e.target.result", e.target.result);
>           setFiles(e.target.result);
>         };   };   return (
>         <>
>           <h1>Upload Json file - Example</h1>
>     
>           <input type="file" onChange={handleChange} />
>           <br />
>           {"uploaded file content -- " + files}
>         </>   ); }

import React, { useState } from "react";

export function Upload({ children }) { const [files, setFiles] = useState("");

const handleChange = e => { const fileReader = new FileReader(); fileReader.readAsText(e.target.files[0], "UTF-8"); fileReader.onload = e => { console.log("e.target.result", e.target.result); setFiles(e.target.result); }; }; return ( <>

Upload Json file - Example

  <input type="file" onChange={handleChange} />
  <br />
  {"uploaded file content -- " + files}
</>   ); }
about 4 years ago · Santiago Gelvez
1 answers
Answer question

0

new FileReader().readAsText(file,“utf-8”);
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!