2
  $("#image").change(function(event) {
    const file = event.target.files[0]
    reader = new window.FileReader()
    reader.readAsArrayBuffer(file)
  });

function saveOnIpfs(reader) {
    return new Promise(function(resolve, reject) {
      const buffer = Buffer.from(reader.result);
      ipfs.add(buffer)
      .then((response) => {
        console.log(response)
        resolve(response[0].hash);
      }).catch((err) => {
        console.error(err)
        reject(err);
      })
    })
  }

this is the error i get in the console

index.js:107 Uncaught (in promise) TypeError: Cannot read property 'result' of undefined
    at index.js:107
    at new Promise (<anonymous>)
    at new t (_export.js:36)
    at HTMLFormElement.<anonymous> (index.js:106)
    at HTMLFormElement.dispatch (jquery.min.js:3)
    at HTMLFormElement.q.handle (jquery.min.js:3)

0 Answers0