9951 explained code solutions for 126 technologies

jqueryUpload file through AJAX

$('button').on('click', function() {
    var form = new FormData();
    form.append('file', $('input[type=file]').prop('files')[0]);
        url: '/upload', data: form, type: 'post',
        success: function(r) { console.log(r); }
});ctrl + c

form submit button selector

new FormData()

create FormData object


appends file field to form data


selector for file input with a file selected already


path to the server-side upload script


replace with your code handling response from the server