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

194
Vistas
What Format should FormData have?

so I want to upload the test JSON to arweave. The appending of transaction and env works fine, but when I try to append bufferTest I get this error

Unhandled Rejection (TypeError): Failed to execute 'append' on 'FormData': parameter 2 is not of type 'Blob'.

I tried doing: data.append('file[]', new Blob(bufferTest), 'metadata.json');, but then it just uploads the Buffer values in UTF8 like this: 1.2334116101115117e+39. I literally just copied this from Metaplex candy-machine-v2. They also just append the Buffer. I don't know if this has something to do with React or me just being stupid.

const test = { "test": "test" };
const bufferTest: any = Buffer.from(JSON.stringify(test)); //metadata as buffer

export default function Test(props:any){

    //...
    const data = new FormData();
    data.append('transaction', txID!); // Transaction ID
    data.append('env', env);  // env = devnet
    data.append('file[]', bufferTest, 'metadata.json');

    const result = await upload(data);
    //...

}
async function upload(data: FormData) {
    return await (
        await fetch(ARWEAVE_UPLOAD_ENDPOINT, {
            method: 'POST',
            // @ts-ignore
            body: data,
        })
    ).json();
}
about 4 years ago · Juan Pablo Isaza
1 Respuestas
Responde la pregunta

0

you need to put a for loop on all files selected inside the input file like the bellow :

var len = document.getElementById('XXXX').files.length;
for (var i = 0; i < len ; i++) {
    fd.append("file[]", document.getElementById('XXXX').files[i]);
}

let me know if it's working

about 4 years ago · Juan Pablo Isaza Denunciar
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