Reputation: 470
Okay, I don't have a code snippet here, I wanted to display a progress bar when I am uploading an image in Django, am using celery and some other stuff, but most importantly i will need to know the size of the file been uploaded so that I can compute the progress of the upload, any suggestion or solutions, please.
Upvotes: 0
Views: 151
Reputation: 950
def file_upload(request):
if request.method == 'POST' and request.FILES['filename']:
file = request.FILES['file']
print(file.size)
# do whatever you want here
return render(request, 'file_upload.html')
Upvotes: 1