I have html form with submit button and input='file' control:

```
<form action="/Profile/UploadFile" enctype="multipart/form-data" method="post" onsubmit="OnUploadSubmit(this)"> 

```

OnUploadSubmit function looks like this:

```
  if (e.files[0].size > 5000000) {
        $('#upload_error').css('display', 'block');
        $('#upload_error').text('The file size is too large for upload')
        e.preventDefault();
        return false;
    }

    var files = e.files;
    var ext = $('#file_uploader').val().split('.').pop().toLowerCase();
    if ($.inArray(ext, ['jpeg', 'jpg', 'png']) == -1) {
        $('#upload_error').css('display', 'block');
        $('#upload_error').text('Only, jpg, jpeg, png is allowed');
        e.preventDefault();
        return false;
    }
    return true;
}

```

e.preventDefault() and return false; doesnot working form is submiting anyway.

Does anybody knows what is my problem?

Thanks