I have a file field from which I am uploading image. Now after uploading the image whthout saving it I want to show it in the template. Like if user browse and selects the photo then that selected photo should be shown in them form.
I am doing something like :
<form action="" method="post" enctype="multipart/form-data">{% csrf_token %}
{{form.image.value}}
{% if form.image.value %}
<br/><img src="{{ form.image.value.url }}" width="240"></img></br>
{% endif %}
{{form.as_p}}
<input type="submit" name="submit" value="Upload">
</form>
and my model:
class Album(models.Model):
image = models.FileField(upload_to=get_upload_file_name)
How can I show the form field value after selecting it ?
Thanks in advance