Hi,

Actually, his solution was correct because when I provided the encryption
it worked, however I am not sure about the reason why it did worked at all.

Thanks a lot.

With Kind Regards
Aakash Baranwal

On 17 Apr 2019 7:23 p.m., "Ram sundar" <[email protected]> wrote:

> Hi Vijay,
>
> You are right, but he has mentioned that it gets uploaded when logged in
> as admin. Will it be a different template for the same view? Just
> wondering...
>
> @Aakaash: can you please check in both cases and confirm please
>
> Regards,
> Ramsundar
>
>
> On Wed 17 Apr, 2019, 6:18 PM Vijay Khemlani, <[email protected]> wrote:
>
>> In your HTML, the form tag should have an enctype
>>
>> <form ... enctype="multipart/form-data">
>> ...
>> </form>
>>
>> On Wed, Apr 17, 2019 at 2:36 AM Aakash Baranwal <[email protected]>
>> wrote:
>>
>>> Sorry, the image file wasnt uploaded.
>>>
>>>
>>>
>>> On Wed, Apr 17, 2019 at 12:04 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/CALr9hQ2eq0np-THVoQOBJ6ux3fqw%
>>> 2BzA1DM4DBHshTP5dMNat2g%40mail.gmail.com
>>> <https://groups.google.com/d/msgid/django-users/CALr9hQ2eq0np-THVoQOBJ6ux3fqw%2BzA1DM4DBHshTP5dMNat2g%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/CALn3ei1ZicOfYs2Xe1CuEuHgxhQVFLv3BDhcEa5VWoa%2BC7JQzw%
>> 40mail.gmail.com
>> <https://groups.google.com/d/msgid/django-users/CALn3ei1ZicOfYs2Xe1CuEuHgxhQVFLv3BDhcEa5VWoa%2BC7JQzw%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/CAGJAuo8y1rQKUkVd0ZgxAEKq74Yz6
> Zi6_3ZU-0r7x4A7pas5WQ%40mail.gmail.com
> <https://groups.google.com/d/msgid/django-users/CAGJAuo8y1rQKUkVd0ZgxAEKq74Yz6Zi6_3ZU-0r7x4A7pas5WQ%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/CALr9hQ0pbUvQevkAv0_UtbdOhq%2BydMfY6Kc%2BrFxVHYGO6qCjmA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to