I have form :
<form id="product" fole="form" action="..." method="post" encrypt="multipart/form-data">
<input type="text" name="productname" id="prod"/>
<input type="file" name="file" id="uploadfile" />
<input type="button" id="Ok" Value="Ok"/>
</form>
I use FormData() upload files to server, my javacript :
<script>
$(function () {
$("#Ok").click(function () {
var file_data = $('#prod')[0].files;
if (file_data == null) return;
var form_data = new FormData();
form_data.append("productname", $("#prod").val());
*// error here : Undefined*
form_data.append("file",file_data);
$.ajax({
url: '/Page.aspx',
data: form_data,
processData: false,
contentType: false,
type: 'POST',
success: function (data) {
.....
}
});
});
});
</script>
When i debug, form_data.append not working, form_data is null.