3 ms·
Just "python -m http.server" If the network is trusted.
by mixcocam 5y ago
Just
"python -m http.server"
If the network is trusted.
- byteface 5y agoimport os from flask import Flask, request, render_template, redirect import requests import shutil app = Flask(__name__) @app.route('/handle_form', methods=['POST']) def handle_form(): f = request.files['file'] f.save(os.getcwd()+'/files/'+f.filename) return redirect("/", 302); @app.route("/") def index(): return render_template("index.html"); if __name__ == "__main__": app.run(host='0.0.0.0', port=8080, debug=True) # <!-- index.html --> # <!DOCTYPE html> # <html> # <head> # <title>Send File</title> # </head> # <body> # <h1>Send File</h1> # <form action="handle_form" method="post" enctype="multipart/form-data"> # <input type="file" name="file"> # <input type="submit" value="Upload"> # </form> # </body> # </html>
- byteface 5y agonever tried to post code on here. didn't realise it wouldn't render.
- grandchild 5y agoif you want a proper version of that with some handy complimentary features, then have a look at https://github.com/sebageek/servefile https://github.com/sebageek/servefile