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

256
Views
Sending files via axios to backend

I have a problem with sending the mp3 file using axios to the backend, everything seems fine when I do console logs on the front, everything is in it, unfortunately on the backend the file field is empty (not null not undefined, just empty).

front console log: enter image description here

backend console log: enter image description here

API:

const API = axios.create({baseUrl: 'http://localhost:5000'})


API.interceptors.request.use((req) => {
    if (localStorage.getItem('profile')) {
        req.headers.Authorization = `Bearer ${JSON.parse(localStorage.getItem('profile')).token}`;
    }

    return req;
})
export const addSong = (newSong) =>  API.post('/songs', newSong);

backend

export const addSong = async (req, res) => {
  const song = req.body;


  console.log(song)


  const newSong = new Song({...song, creator: req.userId, createdAt: new Date().toISOString()});

  try {
    await newSong.save();
    res.status(201).json(newSong);
  } catch (error) {
    res.status(409).json({ message: error.message });
  }
};
about 4 years ago · Santiago Gelvez
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!