Does someone know how to get <input type="file"> value to pass through an Ajax call?
Instead of:
// more...
function uploadFile(event) {
var file = event.target.files;
event.stopPropagation();
event.preventDefault();
var data = new FormData();
$.each(
file,
function(key, value) {
data.append(key, value);
}
);
$.ajax({
url: 'site/upload',
type: 'POST',
data: data,
// more...
The uploadFile() is called on change of the input file.
The problem with using FormData object is that it's not supported in IE 10-.