RESOLVED FIXED 8248
Can not clear file input field
https://bugs.webkit.org/show_bug.cgi?id=8248
Summary Can not clear file input field
Barry Kaplan
Reported 2006-04-07 10:12:19 PDT
I am using an AJAX to submit/upload a file to my server. This works perfectly. After I get the response I want to clear the form to allow the user to upload another file. This does not work. 1) Setting the value of the file input element to "" does nothing. 2) Calling form.reset does nothing 3) removing the element and adding a new file element does nothing. Currently the only way to get this to work is by exploiting this bug# 5196.
Attachments
Ben Jamieson
Comment 1 2006-05-30 06:29:50 PDT
I'm lost as to why this is marked as unconfirmed? Its actually worse than the AJAX implementation outlined in the initial report, and affects any form, using just plain old HTML. Create a form with a file upload element. Select a file. Now decide you don't want to upload a file at this stage and clear the field. You can't. Confirmed... ...and a serious PIA for anyone using Safari on a regular basis. All other browsers let you simply delete the file path. Safari does not. Please fix this.
Joost de Valk (AlthA)
Comment 2 2006-05-30 06:31:44 PDT
Well the reason for it being unconfirmed is quite simple. Nobody with the right to confirm it has yet confirmed it :). I'll look into it when i get home and have access to webkit.
Ben Jamieson
Comment 3 2006-05-30 06:49:24 PDT
(In reply to comment #2) > Well the reason for it being unconfirmed is quite simple. Nobody with the right > to confirm it has yet confirmed it :). Aah, that would make sense! <grin> Thanks for stopping by our little bug and taking the time to respond!
Dave Hyatt
Comment 4 2006-05-30 13:20:04 PDT
Resetting the form should clearly work. Poking the value of a file upload control is not allowed in Safari.
Darin Adler
Comment 5 2007-04-22 09:05:51 PDT
The three things mentioned here are potentially three separate bugs, so they might need separate bug reports. I'm tackling (2) first.
Darin Adler
Comment 6 2007-04-22 09:39:38 PDT
I have a patch that deals with issues (1) and (2). I think that issue (3) is a separate bug and needs a separate bug report and test case.
Darin Adler
Comment 7 2007-04-22 16:35:13 PDT
Sending WebCore/ChangeLog Sending WebCore/html/HTMLInputElement.cpp Adding WebCore/manual-tests/clear-input-file.html Sending WebCore/platform/FileChooser.cpp Sending WebCore/platform/FileChooser.h Sending WebCore/rendering/RenderFileUploadControl.cpp Transmitting file data ...... Committed revision 21010.
Note You need to log in before you can comment on or make changes to this bug.