It is impossible to clear upload file input box. The only standard thing u can use is a .reset() method of the form but it is not good. It will reset all other fields. File input box is READ ONLY, however there is a trick you can do.

The trick is basically to re-create the field from scratch.

Using a jQuery:

$("#filefield_id").parent().html($("#filefield_id").parent().html());

Standard Javascript:

document.getElementById("filefield_id").innerHTML = document.getElementById("filefield_id").innerHTML;

Dima Svirid

Software architect. Ajax/Javascript, HTML5, Android, iPhone/iPad, JAVA, PHP, Cold Fusion, SQL, Air, Flash, Open source software, Frameworks

More Posts

Follow Me:

Tagged with:
 

One Response to Clear upload file input box

  1. Alex Smirnov says:

    Nice trick

Leave a Reply