-1

I am facing this wierd issue with ajax request

if (e.target.files != undefined) {
            var reader = new FileReader();
            reader.onload = function (e) {
                $.ajax({
                    url: Routing.generate('test_ajax_data'),
                    data: e.target.result,
                    processData: false,
                    type: 'POST',
                    success: function (data) {
                        $('#voucherCount').text('Count of records that will be uploaded : ' + data.count);
                    }
                });
            };
            reader.readAsText(e.target.files.item(0));
        }

Output that i am receiving :

enter image description here

Though when i doing print_r($_POST) i am getting an empty array.

Jignesh Rawal
  • 521
  • 6
  • 17

1 Answers1

0

Tried your code, works okay,

Don't really get what your issue is, but I think you should check this out HTML5 File API - Send file to server for processingenter image description here