I have a custom input field, in which I want to upload a file.
<form class="submitform">
<div class="input-group">
<input type="file" class="custom-file-input" id="fileInput"
aria-describedby="fileInput" />
<label class="custom-file-label" for="fileInput">Choose file</label>
</div>
<div class="modal-footer row">
<button type="submit" class="btn btn-primary" id="submitAddFile">Submit</button>
</div>
</div>
</form>
Once, the submit button in my form is pressed, I want to fetch respectively the filename and the byte[]. This I try to do in the following way through jQuery:
$('#submitAddFile').click(function () {
var file = $('#fileInput')[0].files;
debugger;
}
And then I sort of didn't get any further.. From what I can read through debug, I'm not getting any byte[] that I can pull out and send to my controller. I am however able to get things, such as file size and file name.
Therefore, how do i correctly extract the byte[] so that I can store it in my database