#28554: Add support for multiple file fields
-------------------------------------+-------------------------------------
               Reporter:  Johannes   |          Owner:  nobody
  Hoppe                              |
                   Type:  New        |         Status:  new
  feature                            |
              Component:  File       |        Version:  1.11
  uploads/storage                    |       Keywords:  file, storage,
               Severity:  Normal     |  upload, multiple, input
           Triage Stage:             |      Has patch:  0
  Unreviewed                         |
    Needs documentation:  0          |    Needs tests:  0
Patch needs improvement:  0          |  Easy pickings:  0
                  UI/UX:  0          |
-------------------------------------+-------------------------------------
 The `django.db.models.FileField` currently allows only to store a single
 file URL.
 This behavior seems outdated considering that `input[type=file]` supports
 a `multiple`  attribute, which is supported by all major Browsers.
 See: https://www.w3schools.com/tags/att_input_multiple.asp

 I would suggest to have a similar attribute on the database field itself,
 as well as on the form field and widget.

 The major point for discussion would be how to store the data. The easiest
 would be to coma separate the paths in a single char field. The major
 concern here would be the lack of atomicity. For databases like Postgres I
 would be sensical to use the `ArrayField` as an underlying structure.
 Another way for serialisation would be the use of JSONs in a char field.

 All solutions based on a text or char field have an issue related to the
 compatibility with the current `FileField` which is limited to 100
 characters. The type would need to be migrated to a text type or the
 length would need to be increased. The latter options bares the question
 to which point.

 Another approach would be to defer the storage issue and only provide
 support for multiple files on form level.
 This would mean to add a `multiple` attribute to the form field and
 widget. Users would be able to create forms with multiple files in a
 single field and handle storage according to their preference.

-- 
Ticket URL: <https://code.djangoproject.com/ticket/28554>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/052.2805de876dc2fbf7461a7810c8c2f1ef%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to