There are problems in uploading files in Ajax, I have figured that the problem is from form.Serialize()
instead you can use FormData
it as below:
p.s. All versions of browsers doesn't support FormData
<script type="text/javascript">
$(function () {
$('form').submit(function () {
//Below line is added
var formData = new FormData($('form')[0]);
if ($(this).valid()) {
$.ajax({
url: this.action,
type: this.method,
//Below line is changed
data: formData,
success: function (result) {
$('#result').html(result);
}
});
}
return false;
});
});
Also there is a typo in your form declaration change ncType
to enctype
if you are going to use JqueryDialog too, you can find this link useful for uploading files: Uploading file via Jquery ui dialog and Ajax [Resolved]