dimanche 26 juin 2016

Laravel Ajax File Upload not recieving data

I have a ajax form that sends a bunch of data to my conroller, but when I add

processData: false, // important
contentType: false, // important

To my ajax call Laravel receives an empty array in my controller with: $data = Input::all();

Heres the whole ajax call if you want to see it:

    var ImagesData = new FormData();
    ImagesData.append('pictureFile', $('input').get(0).files[0]);

    $.ajax({
        type: 'POST',
        url: '/a/item/create',
        data: ImagesData,
        dataType: 'json',
        processData: false, // important
        contentType: false, // important
        success: function(data){
            console.log(data);
        }
    });



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire