I should have 0 displayed on screen until I click on the upload button but I don't. I've minimised the code as much as I could and it still doesn't behave as I would expect it to behave. The if statement is very straightforward, so I must be missing something obvious.
Here is my flask_app.py file:
# Imports
import os
from flask import Flask, render_template, request, session
# Flask Variables
APP = Flask(__name__)
@APP.route('/', methods=["GET", "POST"])
def hello_world():
messages = ""
return render_template('upload.html').format(
messages=messages,
filename=0,
)
and here is upload.html file:
<html>
<head>
<meta charset="utf-8" />
<title>Face Transforms</title>
<link rel="stylesheet" type="text/css" href="{{ url_for('static', filename='css/upload.css') }}">
</head>
<body>
<h1>Face Transforms</h1>
<form method="POST" action="/" enctype="multipart/form-data">
<td align="left"><input type="file" name="input_file" /></td>
<td align="right"><input type="submit" name="submit_button" value="Upload" /></td>
</form>
{messages}
{% if filename == 0 %}
{filename}
{% endif %}
</body>
</html>
I have tried wrapping 0 with "" in the if statement like so {% if filename == "0" %}
and with single quotes as well but it still doesn't work.