var data = new FormData(); $.each( files, function( key, value ){ data.append( key, value ); }); 

files is an array of files, it is definitely not empty, but nothing is added to data .

    1 answer 1

    And how did you determine that nothing is added there?
    For verification, use the getAll method.
    Try this example:

     $('.files').change(function(ev) { var item = $(this); var data = new FormData(); $.each(ev.currentTarget.files, function (key, value) { data.append('files', value); }); console.log(data.getAll('files')); }); 
     <script src="https://code.jquery.com/jquery-2.2.4.min.js" integrity="sha256-BbhdlvQf/xTY9gja0Dq3HiwQF8LaCRTXxZKRutelT44=" crossorigin="anonymous"></script> <input name="file" class="files" type="file" multiple> 

    https://jsfiddle.net/05qj4tgL/