This week's book giveaway is in the Servlets forum.
We're giving away four copies of Murach's Java Servlets and JSP and have Joel Murach on-line!
See this thread for details.
The moose likes HTML, CSS and JavaScript and the fly likes clearing file input Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Engineering » HTML, CSS and JavaScript
Bookmark "clearing file input" Watch "clearing file input" New topic
Author

clearing file input

ankur rathi
Ranch Hand

Joined: Oct 11, 2004
Posts: 3830
How to clear file input (file upload)?

I am trying this:

document.getElementById("file_browse").value = "";

But it doesn't seem to work. How to achieve this?

TIA.
Eric Pascarello
author
Rancher

Joined: Nov 08, 2001
Posts: 15376
    
    6
You can not change the value of a file for security reasons. Try .reset();

Eric
ankur rathi
Ranch Hand

Joined: Oct 11, 2004
Posts: 3830
Originally posted by Eric Pascarello:
You can not change the value of a file for security reasons. Try .reset();

Eric


Getting 'object doesn't support this property' error. :roll:
Jaikiran Pai
Marshal

Joined: Jul 20, 2005
Posts: 9915
    
158

How about this:



Worked on Firefox and IE, but not sure whether this is a clean approach of doing this.


[My Blog] [JavaRanch Journal]
ankur rathi
Ranch Hand

Joined: Oct 11, 2004
Posts: 3830
Originally posted by Jaikiran Pai:
How about this:



Worked on Firefox and IE, but not sure whether this is a clean approach of doing this.


Nice thinking...
Thanks.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: clearing file input
 
Similar Threads
Vector input .txt
string input for txt file..
Input file
Input file
how to create batch file?