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

195
Views
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 answers
Answer question

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 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!