How to determine if user selected a file for file upload?
If I have a
<input id="uploadFile" type="file" />
tag, and a submit button, how do I determine, in IE6 (and above) if a file has been selected by the user.
In FF, I just do:
var selected = document.getElementById("uploadBox").files.length > 0;
But that doesn't work in IE.
This works in IE (and FF, I believe):
if(document.getElementById("uploadBox").value != "") {
// you have a file
}
this piece of code works in my local environment, hope it will also works in live
var nme = document.getElementById("uploadFile");
if(nme.value.length < 4) {
alert('Must Select any of your photo for upload!');
nme.focus();
return false;
}