Uploaded image for project: 'Spring Framework'
  1. Spring Framework
  2. SPR-2784

Support MultipartFile-array property

    Details

    • Type: Improvement
    • Status: Closed
    • Priority: Major
    • Resolution: Complete
    • Affects Version/s: 2.0 final
    • Fix Version/s: 3.0.4
    • Component/s: Web
    • Labels:
      None
    • Last commented by a User:
      true

      Description

      When posting multiple non-file form fields with the same name, the CommonsMultipartResolver(as CommonsFileUploadSupport ) recognizes this as an array property. When posting multiple file form fields with the same name, the property value is overwritten. If the same logic would be applied, a bean could be populated with a MulitpartFile[] property.

      exmaple:

      public class Bean {
      private String aString;
      private String[] aStringArray;
      private MultipartFile aFile;
      private MulitpartFile[] aFileArray;
      }

      <form>
      <input name="aString" type="text"/>
      <input name="aStringArray" type="text"/>
      <input name="aStringArray" type="text"/>
      <input name="aFile" type="file"/>
      <input name="aFileArray" type="file"/>
      <input name="aFileArray" type="file"/>
      </form>

      if this forms is processed with the CommonsMultipartResolver, the String and String[] properties will be populated correctly (containing the two values in he array), the MultipartFile property will be filled correctly, but the MultipartFile[] property will contain only the last file.

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                juergen.hoeller Juergen Hoeller
                Reporter:
                mwinkels Maarten Winkels
                Last updater:
                Juergen Hoeller
              • Votes:
                7 Vote for this issue
                Watchers:
                12 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved:
                  Days since last comment:
                  7 years, 36 weeks, 2 days ago

                  Time Tracking

                  Estimated:
                  Original Estimate - Not Specified
                  Not Specified
                  Remaining:
                  Remaining Estimate - 0d
                  0d
                  Logged:
                  Time Spent - 1d 2.45h
                  1d 2.45h