Is it possible convert input type = file in HTML 5 to array of bytes in Javascript? I read a few articles about that but the solutions provided don't work for me. I tried these: Getting byte array through input type = file, Return the Array of Bytes from FileReader().
I need it for my ajax post method. In ASP.NET MVC app I have ViewModel with field type of byte[] and I want to write this array to database.
Code in question:
<input type="file" id="Receipt" />
POST method:
$(function () {
$("#btnregister").click(function () {
$.ajax(
{
type: "POST",
url: "AddUser",
data:
{
File: (?)
}
});
});
});
Thanks for any help.