Flask directory upload POC, embed datasheet.info in html comment for parser reuse

This commit is contained in:
Jesse Cirimelli-Low
2018-11-13 17:29:43 -08:00
parent 0dd97e54dd
commit fa27d647d2
5 changed files with 62 additions and 0 deletions
+15
View File
@@ -0,0 +1,15 @@
import os
from flask import Flask, render_template, request
from werkzeug import secure_filename
app = Flask(__name__)
@app.route('/uploader', methods = ['GET', 'POST'])
def upload():
if request.method == 'POST':
f = request.files['file']
dirname = os.path.dirname(os.path.abspath(__file__))
f.save(dirname + '/uploads/' + secure_filename(f.filename))
return 'file uploaded successfully'
if __name__ == '__main__':
app.run(debug = True)
+11
View File
@@ -0,0 +1,11 @@
<html>
<body>
<form action = "http://localhost:5000/uploader" method = "POST"
enctype = "multipart/form-data">
<input type = "file" name = "file" />
<input type = "submit"/>
</form>
</body>
</html>