4👍
✅
There is a typo in your Javascript. It should read {% csrf_token %}
instead of {{ csrf_token }}
.
Edit:
After your comments, I had a closer look at the article you linked.
You need to include the library fileuploader.js
. It will replace the placeholder div with the id file-uploader
with a form with the proper event handlers. Creating a form in plain HTML will not work.
I suggest that you have a look at the example in the Github repository: https://github.com/alexkuhl/file-uploader/tree/master/client
1👍
You need to add return True
to the if-statement that checks if it’s raw data, otherwise it will return False even if the upload is successful:
...
if raw_data:
foo = uploaded.read(1024)
while foo:
dest.write(foo)
foo = uploaded.read(1024)
return True
...
- [Django]-How to customize the response of Django REST Framework GET request?
- [Django]-Dynamic (i.e. Runtime Configurable) Log Configuration for Django + Celery based application
- [Django]-How to remove get parameter from url in django view
- [Django]-Increasing number of initial forms in a Django formset based on data in POST?
Source:stackexchange.com