Skip to content
Snippets Groups Projects
Commit e4cac013 authored by steven.liatti's avatar steven.liatti
Browse files

Initial commit

parents
No related branches found
No related tags found
No related merge requests found
*__pycache__*
uploads/*
\ No newline at end of file
import os
from flask import Flask, render_template, request
from werkzeug import secure_filename
app = Flask(__name__)
app.config['UPLOAD_FOLDER'] = 'uploads'
@app.route('/', methods = ['GET', 'POST'])
def upload_file():
if request.method == 'POST':
f = request.files['file']
f.save(os.path.join(app.config['UPLOAD_FOLDER'], secure_filename(f.filename)))
return 'file uploaded successfully'
else:
return render_template('index.html')
if __name__ == '__main__':
app.run(debug = True)
\ No newline at end of file
<html>
<body>
<form action = "/" method = "POST"
enctype = "multipart/form-data">
<input type = "file" name = "file" />
<input type = "submit"/>
</form>
</body>
</html>
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment