I am talking about uploading the image file to a textbox set as varbinary. Please HELP! Here is the code and the textbox html code:
function WrkerImgeUpload() {
const [fileHandle] = await window.showOpenFilePicker();
const file = await fileHandle.getFile();
const content = await file.text(); // Read content as text
document.getElementById("WorkerImage").value = content;
return false;
}
<div class="form-group">
<label asp-for="WorkerImage" class="control-label"></label>
<input asp-for="WorkerImage" class="form-control" id="WorkerImage" />
<span asp-validation-for="WorkerImage" class="text-danger"></span>
</div><br />
<input type="submit" value="Upload" class="btn btn-primary" onclick="return WrkerImgeUpload()" />