hi friends
I 'm facing a wried behavior of Imageupload
In Models.py
class Market(...)
       title_name=models.CharField(max_length=125)
       photo1  = models.ImageField(upload_to= 'img/marketplace/%Y/%m/
%d', null=True, blank=True)

In views.py
def postyour_adds(request):
    if request.method=='POST':
        form=MarketplaceForm(request.POST,request.FILES)
        if form.is_valid():
            postdict=request.POST.copy()
            newmarket=form.save()
            .............
     .............

In forms.py
class MarketplaceForm(forms.Form):
        title_name = forms.CharField(max_length=125)
        photo1 = forms.ImageField(widget=forms.FileInput
(),required=False)
        # I tried with another way in vain
        #photo1 = forms.Field(widget=forms.FileInput(),required=False)
          def save(self):
                        new_market =Marketplace.objects.create
(title_name=self.cleaned_data['title_name'],
 
photo1=self.cleaned_data['photo1'],
           return new_market


In html file
{% block content %}
<h3> Enter your choice</h3>
        <table>
  <form action="" method="post" enctype="multipart/form-data" >
      {{ form.as_table }}
      <input type="submit" value="Create the account">
  </form>
  </table>
{% endblock %}

Issue is that image names are stored in Database but when i search in
my file system I could not find the image .
when i repeat the same in admin site i could see the file name with
the path i specified in Models.py and the actual image file is present
in the specified location .
I'm not sure why this wried behavior when i upload images from the
user page .Why is that the image is not constructed in my file system
Your solution is very much appreciated
thanks
--~--~---------~--~----~------------~-------~--~----~
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+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to