DEV Community

Cover image for AJAX file upload in chunks using Django, with a progress bar.

AJAX file upload in chunks using Django, with a progress bar.

Shubham Singh Kshatriya on June 25, 2021

Hello!!! There are lot of methods and technologies who allows to create a file uploader. Django also allows you to create a server where you can up...
Collapse
 
iyappan04 profile image
Iyappan M •

Simple, Well Written Code... Working awesome

Collapse
 
amirkhaki profile image
amirkhaki •

Awesome article but what about resumable uploads?

Collapse
 
shubhamkshatriya25 profile image
Shubham Singh Kshatriya •

Thank you.
This article won't do resumable file upload but it's a great case to look into. I will definitely try to find a way for this.

Collapse
 
nickmanibus profile image
Aleksandr_Zem •

Upload for one file ?

Collapse
 
shubhamkshatriya25 profile image
Shubham Singh Kshatriya •

Yes, this code uploads a single file at a time

Collapse
 
d8t profile image
d8t •

Worked 100%!Awesome!

Collapse
 
shubhamkshatriya25 profile image
Shubham Singh Kshatriya •

Glad it helped you!

Collapse
 
karan_s_mittal profile image
Karan Mittal •

It was an awesome Article Shubham. You took complex topic and implemented it in a very easy and beautiful manner for us. Just on more question, In your research, did you find more ways or any 3rd party django apps that are implementing this functionality?

Collapse
 
shubhamkshatriya25 profile image
Shubham Singh Kshatriya •

Thanks Karan. I have used jQuery for this but I guess it can be achieved using vanilla JS and XmlHttpRequest() module. Regarding any third party app, I could not find one. There is a tool named django-dajax for executing asynchronous tasks but I haven't explored that pkg so I am not sure whether it supports file upload or not.

Collapse
 
jonesim profile image
jonesim •

Great article and thanks for providing GitHub repository. I think you are missing initFileUpload in the javascript class above but it is included on GitHub.

Thanks again.

Collapse
 
shubhamkshatriya25 profile image
Shubham Singh Kshatriya •

Thank you. And yes, I missed initFileUpload, sorry for that and much thanks for pointing it out. I have updated the class.

Collapse
 
zeeter profile image
D Smith •

Hey awesome tutorial!

Collapse
 
shubhamkshatriya25 profile image
Shubham Singh Kshatriya •

Hey, thank you!

Collapse
 
shubhamkshatriya25 profile image
Shubham Singh Kshatriya •

Definitely, and much thanks!