Recientemente, necesito tener un script para usar axios post 2 archivos juntos en mi matraz.
Quiero usar append para crear un archivo [] en mi 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", })Y también quiero usar request.files para recibir los 2 archivos en mi matraz:
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]) Pero cuando uso cargar los 2 archivos, me dice algo mal:
werkzeug.exceptions.BadRequestKeyError: 400 Bad Request: The browser (or proxy) sent a request that this server could not understand. KeyError: 0¿Alguien sabe lo que está mal?