Hello Everyone,
-- I want to upload the large video with chunk functions.
kindly let me how to do.
Thanks,
Pravin Yadav
I have already uploaded the video by chunk functions.
it's my views.py.
from django.http import HttpResponseRedirect
from django.shortcuts import render
from .forms import UploadFileForm
from cmspage.models import Menu
#from handle import handle_uploaded_file
def upload_file(request):
menuHeaderlist = Menu.objects.filter(status=1,menu_location='header').all()
menuFooterlist = Menu.objects.filter(status=1,menu_location='footer').all()
if request.method == 'POST':
form = UploadFileForm(request.POST, request.FILES)
if form.is_valid():
handle_uploaded_file(request.FILES['video_name'])
return HttpResponseRedirect('/uploadvideo/upload_file')
else:
form = UploadFileForm()
return render(request, 'uploadvideo/index.html', {'form': form,'menuHeaderlist':menuHeaderlist,'menuFooterlist':menuFooterlist})
def handle_uploaded_file(f):
filename = str(f)
with open('media/uploadvideo/'+filename+'', 'wb+') as destination:
for chunk in f.chunks():
destination.write(chunk)
Thanks in Advance
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 django-users+unsubscribe@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
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/CAEr6%3DdyAZfLxAR80LwMgeR28%2B2vN7LGq21LUa3Zr4LoDnJrNBg%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.
No comments:
Post a Comment