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.
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.
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.
(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!
Resetting the form should clearly work. Poking the value of a file upload control is not allowed in Safari.
The three things mentioned here are potentially three separate bugs, so they might need separate bug reports. I'm tackling (2) first.
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.
Transmitting file data ......
Committed revision 21010.