-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtwa.py
More file actions
33 lines (23 loc) · 784 Bytes
/
twa.py
File metadata and controls
33 lines (23 loc) · 784 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
from flask import Flask, render_template, request, redirect
from os import listdir
app = Flask(__name__)
@app.route("/")
def main():
return render_template("main.html")
@app.route("/photos")
def photos():
images = listdir("static/img/")
return render_template("photos.html", images=images)
@app.route("/send", methods=["GET", "POST"])
def send():
if request.method == "POST":
files = request.files
if "image" not in files:
return render_template("send.html")
image = request.files["image"]
filename = image.filename
image.save(f"static/img/{filename}")
return redirect("/photos")
return render_template("send.html")
if __name__ == "__main__":
app.run(host="0.0.0.0", port=50000, debug=True)