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

163
Vistas
Error when upload file to ipfs in react js

I trying to upload image to ipfs in react js UI. when add image using add button its work but when click on submit button get the next error "Uncaught (in promise) Error: Unexpected input: null normalise-candidate-single.js:16 " and then to store return hash from ipfs in hypeledger fabric

who can help me?

My App.js file as follow
**

import React, { Component } from 'react';
import './App.css';
import { create } from 'ipfs-http-client'

const ipfs = create('http://localhost:5001') 


class App extends Component {
   constructor(props) {
    super(props)
    this.state = {
      buffer: null
    }
  }
 
  
 captureFile = (event) => {
   event.preventDefault()
   //process file for IPFS...
   const file = event.target.files[0]
   const reader = new window.FileReader()
   reader.readAsArrayBuffer(file)
   reader.onloaded = () => {
     this.setState(('buffer', Buffer(reader.result)))
   }

 }
 onSubmit = (event) => {
   event.preventDefault()
   console.log("submiting the form....")
   ipfs.add(this.state.buffer, (error, result) => {
    console.log('Ipfs result', result)
    if(error) {
      console.error(error)
      return
    }
 })
}
 

  
      
      render() {
        return (
                                    
         
      <div>
        
        <div className="container-fluid mt-5">
          <div className="row">
            <main role="main" className="col-lg-12 d-flex text-center">
              <div className="content mr-auto ml-auto">
                 
                <h2>Change Logo</h2>
                <form onSubmit={this.onSubmit} >
                  <input type='file' onChange={this.captureFile} />
                  <input type='submit'/>
                </form>
              </div>
            </main>
          </div>
        </div>
      </div>
    );
  }
}
              
 export default App;
 

**

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