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

266
Views
FormData Returns empty object

I am trying to use FormData to send user-entered data in a POST request with the fetch API. The problem is that when I create a new FormData object with the form that I've created, it keeps creating an empty object - no entries/keys/values

export class FinancialDocumentsController {
  constructor(private requestWithToken: <T>(config: AxiosRequestConfig) => Promise<AxiosResponse<T>>) {}
  
  public createFinancialDocumentsFilesUpload = ({ document, ...data }: CreateFinancialDocumentsFilesUploadReq) => {

    console.log(document, 'document');// {name: "36-2.png",size: 12251,type: "image/png"}

    const formData = new FormData();
    formData.append('document', document);
   
    console.log('formData', formData);//{empty}

    return this.requestWithToken<CreateFinancialDocumentsFilesUploadRes>({
      method: 'POST',
      url: FINANCIAL_DOCUMENTS_FILES_UPLOAD,
      data,
    });
  };
}
about 4 years ago · Juan Pablo Isaza
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!