From a0ad252dbadd007f8a8f04856b384cfeb0c76cd9 Mon Sep 17 00:00:00 2001 From: Kakune55 Date: Wed, 10 Apr 2024 18:16:25 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E4=BA=86=E4=B8=8A=E4=BC=A0?= =?UTF-8?q?=E9=A1=B5=E9=80=BB=E8=BE=91=E5=AD=98=E5=9C=A8=E7=9A=84=E9=97=AE?= =?UTF-8?q?=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- main.py | 7 ++++--- templates/upload.html | 2 +- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/main.py b/main.py index 147cb6c..0b99cf7 100644 --- a/main.py +++ b/main.py @@ -86,9 +86,10 @@ def view(bookid): # 接口 def upload_file(): if request.method == "GET": return render_template("upload.html") - uploaded_file = request.files['file'] - if uploaded_file.filename != '': - uploaded_file.save( config.get("file", "inputdir") + "/" + uploaded_file.filename) + uploaded_file = request.files.getlist('files[]') # 获取上传的文件列表 + for fileitem in uploaded_file: + if fileitem.filename != '': + fileitem.save(config.get("file", "inputdir") + "/" + fileitem.filename) file.auotLoadFile() return redirect("/") diff --git a/templates/upload.html b/templates/upload.html index 8acdd32..13ee23a 100644 --- a/templates/upload.html +++ b/templates/upload.html @@ -16,7 +16,7 @@

文件上传

- +