trying to figure out how to serve user-uploaded files

This commit is contained in:
Yamozha
2021-02-09 18:19:42 +02:00
parent d1280445f4
commit dfda536aab
39 changed files with 93 additions and 22 deletions

View File

@ -5,12 +5,17 @@
{% block content %}
{% if user.is_authenticated %}
Hi {{ user.username }}!<br>
<form action="" method="POST">{% csrf_token %}
<input type="file" name="image" id="image">
<form method="post" enctype="multipart/form-data">
{% csrf_token %}
{{ form.as_p }}
<button type="submit">Upload</button>
</form>
<button type="submit"> Submit </button>
{% else %}
{% if file_url %}
<h3>Succesfully uploaded</h3>
<img src="{{ file_url }}" alt="connect" style="max-height:300px">
{% endif %}
{% else %}
<p>You are not logged in</p>
<a href="{% url 'login' %}">Log In</a>
{% endif %}