Wednesday, June 29, 2011

Re: let the users download files

On Jun 29, 10:34 am, pankaj sharma <new.pankajsha...@gmail.com> wrote:
> hello friends ,
> i have a database in which i have some files say photos...
Why you store you files in database? You need to store the path of
file in database and files area stored in that path or folder.

> {i am uploading photos from django admin.}
> i want to make a template so that the users of my website can download
> these photos ..
> so can anyone provide me some useful information or any link

Code for retrieve file in django template, if file path is store in
database and file store in that path or folder.

{% if variable1 %}
{% for variable2 in variable1 %}
{% if variable2.database_field_name %} <img
src="{{ variable2.database_field_name.url }}" />
{% endif %}
{% endfor %}
{% endif %}

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to django-users+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/django-users?hl=en.

No comments:

Post a Comment