Add a way to display the supported fileformats

This commit is contained in:
jvoisin 2019-02-22 20:31:27 +01:00
parent 1837b53ece
commit 12be535945
3 changed files with 29 additions and 4 deletions

View file

@ -42,7 +42,6 @@ def upload_file():
mimetypes = set() mimetypes = set()
for parser in parser_factory._get_parsers(): for parser in parser_factory._get_parsers():
mimetypes = mimetypes | parser.mimetypes mimetypes = mimetypes | parser.mimetypes
mimetypes = ', '.join(mimetypes)
if request.method == 'POST': if request.method == 'POST':
if 'file' not in request.files: # check if the post request has the file part if 'file' not in request.files: # check if the post request has the file part

View file

@ -39,3 +39,21 @@ a {
a:hover { a:hover {
text-decoration: underline; text-decoration: underline;
} }
li {
margin-bottom: 0;
}
details > summary:before {
content: "▶ ";
}
details[open] > summary:before {
content: "▼ ";
}
.fakelink {
color: #1EAEDB;
}
.fakelink:hover {
text-decoration: underline;
}

View file

@ -3,14 +3,22 @@
<h2>» Remove metadata</h2> <h2>» Remove metadata</h2>
<p> <p>
Upload your image, get a <em>cleaned</em> one in response.<br> Upload your file, get a <em>cleaned</em> one in response.
<br> <br><br>
Please note that while we do not keep a copy of your image,<br> Please note that while we do not keep a copy of your image,<br>
there is no way that you could be certain about this: act accordingly. there is no way that you could be certain about this: act accordingly.
</p> </p>
<details>
<summary>Click <span class='fakelink'>here</span> so see the supported formats</summary>
<ul>
{% for mimetype in mimetypes %}
<li>{{ mimetype }}</li>
{% endfor %}
</ul>
</details>
<br> <br>
<form class='b' method=post enctype=multipart/form-data> <form class='b' method=post enctype=multipart/form-data>
<input type=file name=file id="upload_file" accept="{{ mimetypes }}"> <input type=file name=file id="upload_file" accept="{{ mimetypes | join(', ') }}">
<input type=submit value=Upload> <input type=submit value=Upload>
</form> </form>
{% endblock %} {% endblock %}