I have a form with mulitiple file select. I just want send the each file to server via AJAX(selected via multiple select).
I can get the files using
document.getElementById('attachment_file').files
I want to use something like
var files = document.getElementById("attachment_file").files
$.each(files, function(index, file11){
$.ajax({
url: "/users",
type: 'POST',
dataType: 'json',
data: {doc: {title: file11}},
async: false,
success: function() {
}
});
});
Here I'm not able to pass the file params. any suggesstions
AFAIK files are not allowed to be sent to the server via AJAX due to security constraints. Different libraries handle this issue differently - refer to your library docs.