Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

105
Vistas
File Input in JavaScript function for Tesseract.js

I have this website in which the User Inputs a file and then then the website returns in the console the text in the image. I use Tesseract.js, and the recognize function which has a file as parameter and string for language. Everything works fine when I put a sample file in manually in the function but want to know how to input a file that the users selects. How do I make the user file input in the recognize function? How do I replace "sample.PNG" with the user selected file?

Tesseract.recognize(
    "sample.PNG","eng",
    { 
      logger: m => console.log(m) 
    }
  )
  .catch (err => {
    console.error(err);
  })
  .then(result => {
   console.log(result);
  })
  
  
<html>
<head>
    <script src='https://unpkg.com/tesseract.js@v2.1.0/dist/tesseract.min.js'></script>
 <script src = "script.js"></script>
</head>
<input type="file" name="file" id="fileInput">
<button id = "">Submit</button>
</html>

about 4 years ago · Juan Pablo Isaza
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda