Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

166
Views
Falló la verificación CSRF de Django. Solicitud abortada. error

Estoy tratando de cargar una imagen usando dropzone.js, pero no está usando el inicio de sesión o el registro. Obtengo la CSRF verification failed. Request aborted.

 Dropzone.options.fileDropzone = { url: '/media/', init: function() { this.on("error", function(file, message) { alert(message); this.removeFile(file); }); var submitBtn = document.querySelector("#submitBtn"); var myDropzone = this; submitBtn.addEventListener("click", function() { console.log("upload"); myDropzone.processQueue(); }) }, autoprocessQueue: true, clickable: true, thumbnailHeight: 90, thumbnailWidth: 115, maxFiles: 1, maxFilesize: 10, parallelUploads: 1, addRemoveLinks: true, dictRemoveFile: 'delete', uploadMultiple: false, }
 <form class="imageUploaderForm" method="post" id="upload" enctype="multipart/form-data"> {% csrf_token %} <div class="form-title">Upload your Image</div> <div class="upload-type">File should be Jpeg, Png, Gif</div> <div class="dropzone" tabindex="0" class="drop-zone" style="border-style: dotted;" id="fileDropzone"> <input accept="image/jpeg, image/png, image/gif" multiple="" type="file" autocomplete="off" tabindex="-1" name="myFile" class="drop-zone-input" style="display: none;"> <div class="placeholder"> <img class="hide" width="115" height="90" src="#" id="preview"> </div> </div> <span style="color: rgb(169, 169, 169);">or</span> </form>

y yo solía

var CSRF_TOKEN = $('meta[name="csrf-token"]').attr('content');

y

headers: { 'x-csrf-token': CSRF_TOKEN, },

estos dos códigos pero todavía tienen el mismo error

about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

Intenta usar lo siguiente:

 headers: { 'X-CSRF-TOKEN': $("input[name=csrfmiddlewaretoken]").val() }
about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!