trying to figure out how to serve user-uploaded files
This commit is contained in:
@ -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 %}
|
||||
|
Reference in New Issue
Block a user