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

415
Views
'BadRequestError: Only json objects or array allowed'

I am a beginner in coding just started with node.js ,I want to send an excel file from client side to server side using ajax post method. But while trying this code I am getting error 'BadRequestError: Only json objects or array allowed'. Can someone please tell me what I am doing wrong here.

<div>
<input type="file" name="myFile" id="myFile" multiple/>
<input type="button" value="Upload" ng-click ="fileUpload($event)">
</div>


$scope.fileUpload = function() {
    const myFile = document.getElementById("myFile").files;
    var formData = new FormData();

    for (var i =0; i<myFile.length; i++) {
        formData.append("myFile", myFile[i]);
    }
    dataFactory.post("/excel.json", formData).then(function(res) {
        console.log(res);
    }, function() {

    });
  };

  Error :POST http://localhost:5000//excel.json 500 (Internal Server Error)
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!