Javascript:
var file = this.files[0]; if(!file) return; $.ajax({ type: 'POST', url: '/file.php', data: 'cover='+file, success: function(data){ console.log(data); }, error: function(){ alert('error'); } });
How to save a file on the server?
print_r($_FILES);
I get Array ()
On print_r($_POST);
I get Array ([cover] => [object File])