I'm having a small issue with a webpage I am creating. Essentially, I am looking to validate whether a user has selected a file and then upload it to the server. I understand this can be done using JavaScript:
if(document.getElementById("uploadBox").value != "") {
// file has been selected
}
However, when I add the property runat="server" to my input:
<input id="myFile" type="file" runat="server" />
I am unable to perform validation. Do you have any suggestions on how I can achieve this?
PS: I would like to validate with JavaScript to handle the postback and display error messages using ajax. This is why I prefer not to use server-side code for validation.
Thank you :)