The ASP.NET FileUpload control maps to the HTML input element with type="file". This element is considered Read-only and you cannot change it directly.
However, there seem to be atleast three workarounds to accomplish the goal of "clearing the field" :
a. Reset the form, either using script or by providing a input type="reset" button.
b. Re-establish the input field in the DOM by setting its attributes again:
var fu = document.getElementById("fileUpload");
if (fu != null)
{
fu.setAttribute("type", "input");
fu.setAttribute("type", "file");
}
c. Recreate the innerHTML of the field from the existing innerHTML as http://gusiev.com/2009/04/clear-upload-file-input-field/:
var fu = document.getElementById("fileUpload");
if (fu != null)
{
// You may be able to use the cached object in `fu`, but I'm not sure.
document.getElementById("fileUpload").innerHTML = fu.innerHTML;
}