Closed Bug 702949 Opened 13 years ago Closed 12 years ago

<input type="file"> doesn't submit form in case of filling wrong filename

Categories

(Core :: DOM: Core & HTML, defect)

defect
Not set
normal

Tracking

()

RESOLVED FIXED
mozilla22

People

(Reporter: karel.sluka, Assigned: mounir)

References

Details

Attachments

(1 file, 1 obsolete file)

User Agent: Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/535.2 (KHTML, like Gecko) Chrome/15.0.874.120 Safari/535.2 Steps to reproduce: I clicked on input to upload a file. I selected the file from Open dialog box and confirmed it. After confirming dialog the file I have chosen was removed from the filesystem. As last step I submited the form. Actual results: No request was sent to the server. Expected results: Send request to the server according resource defined in form action attribute. (This worked in Firefox 3.6 but not later).
Component: General → HTML: Form Submission
QA Contact: general → form-submission
Severity: normal → critical
Status: UNCONFIRMED → NEW
Ever confirmed: true
Jonas, Jignesh has narrowed down where this is failing. We're now looking at the correct way to deal with this - my instinct is to create an empty stream instead of the file stream, but Chrome apparently discards the entire input element from the form submission and displays a warning indicating as such. Is this specced at all?
Nevermind about the Chrome behaviour - that was actually Zimbra's warning, not the browser's.
Looks like Chrome submits an empty file.
Blocks: 634666
Submitting an empty file sounds like an ok solution to me. Alternatively we could use the form-validation code to focus the file control and let the user choose a new file.
(In reply to Jonas Sicking (:sicking) from comment #4) > Submitting an empty file sounds like an ok solution to me. Alternatively we > could use the form-validation code to focus the file control and let the > user choose a new file. Using the form validation mechanism to say "The file you are trying to upload has been deleted in the meantime, please select a new one." seems way nicer regarding UX but do we really care for such an edge case?
Hmm.. the problem is that we need to check synchronously, so yeah, probably not worth doing. Submitting an empty file seems like an improvement though.
I wonder whether we could open the file at the time immediately after it is picked, in order to keep a handle on the file that will be valid after it is unlinked. At least that is the Unix behavior; I'm not sure of the NT behavior; perhaps on NT the handle would prevent the file from being deleted, which would also be fine.
An older report: bug 479429.
(In reply to Aleksej [:Aleksej] from comment #8) Please ignore that, wrong bug, sorry.
Severity: critical → normal
OS: Windows 7 → All
Hardware: x86_64 → All
Version: unspecified → Trunk
Attached patch Patch (obsolete) — Splinter Review
Assignee: nobody → mounir
Status: NEW → ASSIGNED
Attachment #720475 - Flags: review?(jonas)
Comment on attachment 720475 [details] [diff] [review] Patch This will cause sync IO.
Attachment #720475 - Flags: review?(jonas) → review-
Attached patch PatchSplinter Review
Using aBlob->GetSize() as the current code does. Though, it's not clear to me why this wouldn't do IO unless the file is cached somehow. Anyway, keeping the same method is probably better.
Attachment #720475 - Attachment is obsolete: true
Attachment #720490 - Flags: review?(jonas)
Flags: in-testsuite+
Target Milestone: --- → mozilla22
Status: ASSIGNED → RESOLVED
Closed: 12 years ago
Resolution: --- → FIXED
Summary: <input type="file" doesn't submit form in case of filling wrong filename → <input type="file"> doesn't submit form in case of filling wrong filename
Component: HTML: Form Submission → DOM: Core & HTML
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: