Bug 8248
Summary: | Can not clear file input field | ||
---|---|---|---|
Product: | WebKit | Reporter: | Barry Kaplan <webkit> |
Component: | Forms | Assignee: | Darin Adler <darin> |
Status: | RESOLVED FIXED | ||
Severity: | Normal | CC: | ap, benjjamieson, ian, joost |
Priority: | P2 | ||
Version: | 417.x | ||
Hardware: | Mac | ||
OS: | OS X 10.4 |
Barry Kaplan
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 | ||
---|---|---|
Add attachment proposed patch, testcase, etc. |
Ben Jamieson
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)
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
(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
Resetting the form should clearly work. Poking the value of a file upload control is not allowed in Safari.
Darin Adler
The three things mentioned here are potentially three separate bugs, so they might need separate bug reports. I'm tackling (2) first.
Darin Adler
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
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.