Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

113
Visualizações
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
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda