2👍
My solution for getting multiple files from html and upload that files in django
index.html
<div id="fine-uploader-manual-trigger">
<input class="custom-file" type="file" name="imgname" id="productImgUpload" accept=".xlsx,.xls,image/*,.doc,audio/*,.docx,video/*,.ppt,.pptx,.txt,.pdf" multiple>
</div>
views.py
filelist = request.FILES.getlist('imgname')
for i in range(len(filepath)):
filename = filelist[i]
1👍
request.FILES
is a MultiValueDict
and doing get
will return only the last value as you noted. If you want all of the values you should use images = request.FILES.getlist('image')
.
- [Answered ]-Get query result as a tuple to make substitution
- [Answered ]-Moving Django 1.6 to new server
- [Answered ]-How do I sort the queryset by a property's property? django
- [Answered ]-Django Views: DoesNotExist isn't working
- [Answered ]-Django DateTime
-1👍
i just try for getting multiple images from static folder to html page using for loop in Django.
{% for i in lst %}
<td style="margin-left: 10px;">
<img src="{% static '/images2/' %}{{i}}.png" style="width: 300px; height: 200px;">
{% endfor %}
- [Answered ]-Problems setting up Django with Mongo db in windows 8
- [Answered ]-Send Email Issue – Google Compute Engine VM
- [Answered ]-How can handler get information from raise PermissionDenied('info') exception?
Source:stackexchange.com