In Cakephp 3.6 I cannot upload an image through a form

He does the same thing. But I’ve noticed that it doesn’t get the event.target.files so it doesn’t make a var data = new FormData(this); but if a var data = $(this).serialize(); ignoring the file.

if(event.target.files) {
      	       var data = new FormData(this);
	       contentType = false;
		processData = false;
	}
	else {
	 	var data = $(this).serialize();
	}