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

206
Views
Vue 3 + Laravel 9 API - processing formData multiple files

I'm currently trying to process multiple files from a Vue frontend to a Laravel backend API. I succesfully uploaded a single file. The problem I'm facing at the moment is that I can't find a way to access an array of files in my API.

My form data structure looks like this:

postSingle(data) {

    let formData = new FormData();
    formData.append('title', data.formInputs.title.value);
    formData.append('description', data.formInputs.description.value);
    formData.append('audiofiles', data.formInputs.audiofiles.value);

    return axios.post(API_URL, formData,
        { headers: authHeader( 'fileUpload' ) });
}

'audiofiles' contains the following data [screenshot of console log data.formInputs.audiofiles.value]

How do I access these audiofiles in the backend via $request?

about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

you need to use loop try this way

postSingle(data) {

    let formData = new FormData();
    formData.append('title', data.formInputs.title.value);
    formData.append('description', data.formInputs.description.value);

    Object.keys(data.formInputs.audiofiles.value).forEach((key) => {
       formData.append('audiofiles[]', data.formInputs.audiofiles.value[key])
    })

    return axios.post(API_URL, formData,
        { headers: authHeader( 'fileUpload' ) });
}
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!