Yes Sir, I corrected it. Thanks a lot.
Best Aakash On Thu, Apr 18, 2019 at 8:46 PM adarsh pandey <[email protected]> wrote: > Gentle man you have not given enctype=" form/multipartdata" in the form > tag of the HTML file > > > On Wed, Apr 17, 2019, 12:05 PM Aakash Baranwal <[email protected]> > wrote: > >> Hi Everybody, >> >> I am trying to upload a file, but it says "No file chosen", even when I >> have selected the file. However it is getting uploaded when I have logged >> in as as admin and i am uploading it from there. >> >> Kindly help me, thanks in advance. >> >> views.py file: >> >> class VideoCreateView(CreateView): >> form_class = VideoModelForm >> fields = ['Video_Description','videofile'] >> template_name = 'deploy/create_view.html' >> >> success_url = "/video/create/" >> >> def form_valid(self, form): >> form.instance.user = self.request.videofile >> return super(VideoCreateView, self).form_valid(form) >> >> >> models.py file: >> >> class Video(models.Model): >> Video_Description= models.CharField(max_length=500) >> videofile= models.FileField(upload_to='videos/', null=True, >> verbose_name="") >> timestamp = models.DateTimeField(auto_now_add=True) >> >> class Meta: >> ordering = ['-timestamp'] >> >> >> def __str__(self): >> return self.Video_Description + ": " + str(self.id) >> >> >> urls.py file: >> >> >> url(r'^create/$', VideoCreateView.as_view(), name='create') >> >> >> create_view.html : >> >> <form class='form' method="POST" action=""> >> {% csrf_token %} >> {{ form.as_p }} >> <input type="submit" value="Upload" / > >> </form> >> >> PFA the image file displaying the page after i selected the file and hit >> the Upload Video button >> >> With Kind Regards >> >> Aakash Baranwal >> >> -- >> You received this message because you are subscribed to the Google Groups >> "Django users" group. >> To unsubscribe from this group and stop receiving emails from it, send an >> email to [email protected]. >> To post to this group, send email to [email protected]. >> Visit this group at https://groups.google.com/group/django-users. >> To view this discussion on the web visit >> https://groups.google.com/d/msgid/django-users/CALr9hQ0iBSOt1tUxXUW06bVBd%2B1Crm-O8_A-tyV01jtGWhS5sw%40mail.gmail.com >> <https://groups.google.com/d/msgid/django-users/CALr9hQ0iBSOt1tUxXUW06bVBd%2B1Crm-O8_A-tyV01jtGWhS5sw%40mail.gmail.com?utm_medium=email&utm_source=footer> >> . >> For more options, visit https://groups.google.com/d/optout. >> > -- > You received this message because you are subscribed to the Google Groups > "Django users" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to [email protected]. > To post to this group, send email to [email protected]. > Visit this group at https://groups.google.com/group/django-users. > To view this discussion on the web visit > https://groups.google.com/d/msgid/django-users/CAKzwNoZBxxjgqchh1UbtK1r_W1fjTYaFg6ASh-q%2BgjFPvTPVaQ%40mail.gmail.com > <https://groups.google.com/d/msgid/django-users/CAKzwNoZBxxjgqchh1UbtK1r_W1fjTYaFg6ASh-q%2BgjFPvTPVaQ%40mail.gmail.com?utm_medium=email&utm_source=footer> > . > For more options, visit https://groups.google.com/d/optout. > -- You received this message because you are subscribed to the Google Groups "Django users" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected]. Visit this group at https://groups.google.com/group/django-users. To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/CALr9hQ2UX_amyG%3DCaNtc6MuW97M7go26Vxcw-E%3Dbam%3DZcsDA6w%40mail.gmail.com. For more options, visit https://groups.google.com/d/optout.

