If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below. |
|
|
Thread Tools | Display Modes |
#1
|
|||
|
|||
django-ajax-uploader how to send csrf_token with fine-uploader 3.5.0
I am implementing django-ajax-uploader in a project, but I want to use latest version of fineuploader that is currently under 3.5.0, supposedly, as documentation says the only thing I should do to send csrf_token is putting it inside customHeaders dictionary:
If you want to use the latest version of Fine Uploader, as valum's file-uploader is now called, instead of the one bundled with django-ajax-uploader, you can do so by replacing the params arguments in the above template with the following customHeaders: customHeaders: { 'X-CSRFToken': '{{ csrf_token }}', }, Here is my full code: .... <h1>qq-file-uploader</h1> <div id="upload-button" class="btn btn-primary"><i class="icon icon-cloud-upload icon-white"></i> Selecciona un archivo</div> <div id="file-upload"></div> </form> {% endblock %} {% block styles %} <link rel="stylesheet" type="text/css" href="{{ STATIC_URL }}js/libs/jquery.fineuploader-3.5.0/fineuploader-3.5.0.css"/> {% endblock %} {% block javascript %} <script type="text/javascript" src="{{ STATIC_URL }}js/libs/jquery.fineuploader-3.5.0/jquery.fineuploader-3.5.0.min.js"></script> <script type="text/javascript"> $(function(){ $('div#file-upload').fineUploader({ customFields: { 'X-CSRFToken': '{{ csrf_token }}' }, request: { endpoint: '{% url 'documents:qq_file_uploader' %}' }, button: $('div#upload-button'), multiple: false, }); }); </script> {% endblock %} In my views.py I have: qq_file_uploader = AjaxFileUploader() And everytime I try to upload any file within the view a I got a 403 error: CSRF verification failed. Request aborted. source http://www.code.mycodetips.com/17702...-fine-uploader |
Ads |
Thread Tools | |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Ajax is a superstar! | Kate[_8_] | Jeep | 0 | March 11th 10 10:38 AM |
buy product send web | [email protected] | Technology | 0 | December 18th 07 06:16 PM |
Another List of headers to send to Cox.net | 24Bit® | Auto Photos | 6 | December 1st 06 02:17 AM |
trying to send pics | Laredo Muchacho | Jeep | 10 | August 31st 06 12:15 PM |
Let's send some pirates over to Williams! :) | Byron Forbes | Simulators | 0 | August 23rd 05 03:11 PM |