Ticket #13306 (closed bug: fixed)
File input added to serialized forms caused a change in behavior and only halfway follows spec
| Reported by: | timmywil | Owned by: | dmethvin |
|---|---|---|---|
| Priority: | blocker | Milestone: | 1.9.1 |
| Component: | ajax | Version: | 1.9.0 |
| Keywords: | Cc: | ||
| Blocking: | Blocked by: |
Description
According to the spec, file inputs with files attached should be serialized with special values. However, plugins that specialize in uploading files, such as jQuery File Upload, handle serializing file inputs for us and they do it in ways that are able to take advantage of some HTML5 features when available. In other words, I think all we need to do is what we did before 1.9, which was ignore file inputs in serialization.
This test case demonstrates the difference in serialization between 1.8 and 1.9 and shows that the value is still empty string when files are attached.
Change History
comment:1 Changed 5 months ago by dmethvin
- Owner set to dmethvin
- Priority changed from undecided to blocker
- Status changed from new to assigned
- Component changed from unfiled to ajax
- Milestone changed from None to 1.9.1
comment:2 Changed 5 months ago by timmywil
Correction, we don't leave the value empty, but it's still true that we don't serialize it to spec.
comment:3 Changed 5 months ago by Timmy Willison
- Status changed from assigned to closed
- Resolution set to fixed
Ignore file inputs when serializing forms. File input serialization is handled by plugins. Fixes #13306.
Changeset: caac041fcc31724b8b579939e8053966559483ca
Please follow the bug reporting guidlines and use jsFiddle when providing test cases and demonstrations instead of pasting the code in the ticket.

Ref #12134 where the bug was introduced. Although the spec says type="file" should be serialized, jQuery itself doesn't serialize them so we should leave them out. It should just be a case of adding file to the rsubmitterTypes regex.
https://github.com/jquery/jquery/commit/ae215fdcf843862dbddbdfd68117ac2926e35a42