How send an "input file" from ajax to my controller? (I am using Laravel)

How send an "input file" from ajax to my controller? (I am using Laravel)

JavierSaavedraJavierSaavedra Posts: 2Questions: 1Answers: 0
edited September 2019 in Free community support

Hi everybody!, i have a lot of time trying to send my input file with ajax to my controller but i can´t, i tried with "FormData" to send a complete form but does´n works in "DataTable", somebody have a solution to send an input file to my controller using DataTable ajax?
The next code works but don't in DataTable ajax:

 $.ajax({
           url: 'CargarExcel',
           dataSrc: '',  
           type: 'post',
           xhrFields: {
               withCredentials: true
           },  
           data: formData,
           contentType: false,
           cache: false,
           processData: false,
});

Answers

  • JavierSaavedraJavierSaavedra Posts: 2Questions: 1Answers: 0

    ...

  • colincolin Posts: 15,237Questions: 1Answers: 2,598

    Hi @JavierSaavedra ,

    We're happy to take a look, but as per the forum rules, please link to a test case - a test case that replicates the issue will ensure you'll get a quick and accurate response. Information on how to create a test case (if you aren't able to link to the page you are working on) is available here.

    Cheers,

    Colin

This discussion has been closed.