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

247
Views
angular file uploader methods for http request

I'm trying to use angular-file-uploader and upload a file. in afuConfig, I want to set method to POST but in terminal I have errors.

uploadAPI:  {
      url:"https://example-file-upload-api",
      method:"POST",
      headers: {
     "Content-Type" : "text/plain;charset=UTF-8",
      },
}

it gives me this:

  The types of 'uploadAPI.responseType' are incompatible between these types.
    Type 'string' is not assignable to type '"blob" | "json" | "arraybuffer" | "text" | undefined'.

I have the same problem for using responseType too.

over 4 years ago · Santiago Trujillo
2 answers
Answer question

0

The default responseType is json. Try to assign the responseType: text explicitly

uploadAPI: {  
  url: "https://example-file-upload-api",
  method:"POST",
  headers: {
    "Content-Type" : "text/plain;charset=UTF-8",
  },
  responseType: 'text'
}
over 4 years ago · Santiago Trujillo Report

0

try below code for headers:

httpOptions: {
  headers:{
    accept: 'application/pdf'
  }
  responseType: 'blob',
}
over 4 years ago · Santiago Trujillo 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!