IE allows users to type in the value in a file field, it's Firefox
that prevents that.

Also I think the syntax there may be wrong. I would use the name of
the file field and change it's value attribute to blank.

HTML: <input type="file" name="fileName" id="fileName" />

jQuery (using 1.3.x)
$("#button").click(function(){
        $("input[name='fileName']").attr("value","");
});

You can change the attributes of any other kind of input field that
way, I can't image a file field is any different.

On Mar 6, 8:29 am, Martijn Houtman <martijn.hout...@gmail.com> wrote:
> On Mar 6, 2:24 pm, Renato Bezerra <bezerra.ren...@gmail.com> wrote:
>
> > $('#button').click(funtion(){
> >         $('#fileName').val('');
>
> > });
>
> > In the Firefox it works, but in the IE7 don't works.
>
> I believe this is a security issue, where the browser does not allow
> you to set the value for a file input, because some malicious script
> might send a different file than you selected by setting the value of
> the input.

Reply via email to