I use following form to file upload:
<form method="POST" action="uploadImage" enctype="multipart/form-data" id="imageUploadForm">
<input type="file" class="file" name="file"/>
</form>
and following ajax to send content to server.
$('.file').click(function(){
var formData = new FormData($('#imageUploadForm')[0]);
$.ajax({
url: 'uploadImage', //Server script to process data
type: 'POST',
success: alertSucces,
data: formData,
cache: false,
contentType: false,
processData: false
});
});
function alertSucces(){
alert("success");
}
I see alert "success" as soon as I clicked on button. Expected result - see this message as soon as file will load on server.
What do I wrong?