Allow uploading multiple files with a single post to my saveserver
This commit is contained in:
parent
59cbbf78ec
commit
34a498e496
@ -7,7 +7,7 @@ app = Flask(__name__)
|
||||
FORM = """
|
||||
<html>
|
||||
<form action="/" enctype="multipart/form-data" method="post">
|
||||
<input type="file" name="the_file" />
|
||||
<input type="file" name="the_file" multiple="multiple" />
|
||||
<input type="submit" name="submit" />
|
||||
</form>
|
||||
</html>
|
||||
@ -16,8 +16,8 @@ FORM = """
|
||||
@app.route("/", methods=["GET", "POST"])
|
||||
def form():
|
||||
if request.method == "POST":
|
||||
f = request.files["the_file"]
|
||||
f.save('./' + secure_filename(f.filename))
|
||||
for f in request.files.getlist('the_file'):
|
||||
f.save('./foto_' + secure_filename(f.filename))
|
||||
return FORM
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user