Html code :
<input type="file" id="file" />
jQuery code :
$.ajax({
url: 'go.php',
data: {file:$('#file').attr('files'),upload:name},
cache: false,
contentType: 'multipart/form-data',
processData: false,
type: 'POST',
success: function(data){
alert(data);
},
error: function(data){
alert("error");
}
});
PHP code :
if(isset($_POST['file'])){
echo "1";
}
After upload alert empty message !
But this code should error "1"