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

260
Views
how to send base64 string with dropzone.js instead of binary file

I am trying to work with dropzone.js but my backend accepts json data with file as base64 string so I implemented ajax into on('sending') function but the problem is dropzone tries to send data normal way and also this so this ajax works but normal post file action fails. How can I disable that standard action and just use mine? Or change default dropzone.js action to send my data json?

  $(".dropzone").dropzone({
            url: "/file/UploadFile",
         autoProcessQueue: false,
        init: function () {
            var myDropzone = this
            $(".submit-file").click(function (e) {
                
                myDropzone.processQueue();
            });

            this.on("sending", function (file, xhr, formData) {
                
                data = JSON.stringify({ "FileName": file.name.replace(/\.[^/.]+$/, ""), "EncodedFile": file.dataURL.replace(/^data:image\/[a-z]+;base64,/, ""), "FileExtension": file.name.split('.').pop(), "ddID": myDropzone.element.dataset.dropzoneFormId });
                
                               
                $.ajax({
                    url: "/file/UploadFile",
                    headers: {
                        'Accept': 'application/json',
                        'Content-Type': 'application/json'
                    },
                    method: 'POST',
                    dataType: "json",
                    data: data
                }).done(function (data, textStatus, xhr) {
                    console.log(data);
                       
                });
            });
        }
    });
about 4 years ago · Juan Pablo Isaza
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!