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

109
Views
How can I upload 2 files from axios?

Recently, I need to have a script to use axios post 2 files together to my flask.
I want to use append to create a file[] in my vue.

       let formData = new FormData();
       formData.append('files',this.file1);
       formData.append('files',this.file2);
       axios({
        method: "post",
        data:formData,
        headers: {
      'Content-Type': "multipart/form-data",
    },
        url: "http://127.0.0.1:5000/getPic",
        responseType: "arraybuffer", 
      })

And I also want to use request.files to receive the 2 files in my flask:

    files=[]
    for i in range(len(request.files)):
      {files.append(request.files[i])}
    file_len =len(files)
    if(file_len == 0):
      return "未上传文件"
    if(file_len == 1):
      return "只上传了一个文件"
    for i in file_len:
      print (files[i].filename)
    file1 = Image.open(files[0])

But when I use upload the 2 files it tell me something wrong:

werkzeug.exceptions.BadRequestKeyError: 400 Bad Request: The browser (or proxy) sent a request that this server could not understand.
KeyError: 0

Does anyone know what's wrong?

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!