141 karma · joined Nov 6, 2013 (13y ago) · 139 submissions
comment 5y ago · link · parent
import 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>comment 5y ago · link · parent
What I like about Dylan is that his lyrics seem to try to avoid cliches rather than over use them so he uncovers truths that go against the social memetic way of thinking.
comment 5y ago · link · parent
comment 5y ago · link · parent
I learned to run code without re-reading it from a bad coder. I used to spend a few mins reading code I'd written to double check it. Then i worked with a guy that just would run code, it would error, my heart would jump, but the world wouldn't explode. So I do that too nowadays a little bit sometimes. Just run the code after writing it without rereading it. It's scary but works 85% of the time. thing is you can run code twice and let the console tell you the issue often quicker than you reading it carefully. (be careful with this tip.) .i.e there's a time to do it and a time not to. i.e. if your changing some css block, you may not need to reread it 5 times before refreshing the page. but if you are about recursively rm some dir then maybe check.
comment 5y ago · link · parent
comment 6y ago · link · parent
comment 6y ago · link · parent
<div class="fb-comments" data-href="http://yoursite.com/yourpage” data-width="100%" data-numposts="5" data-colorscheme="light" data-order-by="time"></div>
comment 6y ago · link · parent
comment 6y ago · link · parent
comment 6y ago · link · parent
comment 6y ago · link · parent
comment 6y ago · link · parent