Thursday, July 16, 2009

How to clear file upload field value using js

We can't assign or remove value through js for file upload field. We can remove value only through reset button only.
But we can do it simply as below.
First take that file field in div or any other container tags like span etc.,
and in js give that div's innerHTML as input type="file" name="img". So new file upload element is created within that div.