1

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);
        }
    });

2 Answers 2

1

You should use Input::file($key). See this part of the documentation.

$file = Input::file('pictureFile');
Sign up to request clarification or add additional context in comments.

Comments

0

If you set

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

you need to create new form with javascript form standard.

var ImagesData = new FormData($('form')[0]);

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.