@app.route("/upload", methods=["GET", "POST"])
def upload():
if request.method == 'POST':
if 'file' not in request.files:
print(1)
flash('No file part')
return redirect(request.url)
file = request.files['file']
if file.filename == '':
print(2)
flash('No selected file')
return redirect(request.url)
if file and allowed_file(file.filename):
print(3)
filename = secure_filename(file.filename)
session["id"] = filename
file.save(os.path.join('UPLOAD', filename))
return redirect(url_for('uploaded',
filename=filename))
return render_template('upload.html')