Hi Brice, Interesting thought. I never looked at it from this perspective.
I did some research. There is no way to reflect a file limit a HTML form (without Javascript). Furthermore there is no way to prevent people to send a request with more files, you could only limit the request body size (which is recommendable anyways). So if one would send more then the max file limit, would we respond with a 400 response? Looking at all this I see too many question marks. I would want to keep this simple and keep the same pattern the HTML file input follows. That might just be more intuitive for users anyways. Good thinking tho, brilliant. Best -joe -- Johannes Hoppe www.johanneshoppe.com Want to chat? Let's get a coffee! https://calendly.com/codingjoe/coffee Lennéstr. 19 14469 Potsdam USt-IdNr.: DE284754038 On 27. Aug 2018, 09:12 +0200, Brice Parent <cont...@brice.xyz>, wrote: > Hi Joe, > Just an idea: > Why not just use another keyword argument, like "files_number", "count", > "max_files" (along maybe with a "min_files"), or something like, with a > default of 1 (to match current behaviour with a single file), and an allowed > value of 0 for infinite? > If you allow multiple files upload at once, chances are that there will be > many use cases for limiting the number of uploads to a specific range/value. > Not sure about the form's implementation, though. > - Brice > > Le 25/08/2018 à 21:05, Johannes Hoppe a écrit : > > Hi there! > > > > I do need some feedback on the best public API to implement multi file > > support to Django forms. > > > > Context: > > > > Up until now Django forms do not support multi file upload. You will need > > to write your own view to handle the files as described here: > > https://docs.djangoproject.com/en/2.1/topics/http/file-uploads/#uploading-multiple-files > > > > Of course it is not too hard to implement actual multi file support as I > > have been showcasing here: > > https://github.com/django/django/pull/9011/files > > > > The question is now to best add support for multiple file uploads without > > wrecking backwards compatibility? > > > > As Tim wisely mentioned, it might be confusing to add a `multiple` argument > > to the FileField while also having the > > attrs={'multiple': True} > > still in the mix. > > > > My suggestion would be to add the new keyword argument which enable the new > > behavior and keep the attr-thing as is. > > I could add a warning if someone uses the "old" style. It is a bit > > suggestive though. > > > > What do you think, mabe look at the documentation changes in the PR for > > more context. > > > > Best > > -Joe > > -- > > You received this message because you are subscribed to the Google Groups > > "Django developers (Contributions to Django itself)" group. > > To unsubscribe from this group and stop receiving emails from it, send an > > email to django-developers+unsubscr...@googlegroups.com. > > To post to this group, send email to django-developers@googlegroups.com. > > Visit this group at https://groups.google.com/group/django-developers. > > To view this discussion on the web visit > > https://groups.google.com/d/msgid/django-developers/e71675d3-be96-4189-b0c1-038774626284%40googlegroups.com. > > For more options, visit https://groups.google.com/d/optout. > > -- > You received this message because you are subscribed to a topic in the Google > Groups "Django developers (Contributions to Django itself)" group. > To unsubscribe from this topic, visit > https://groups.google.com/d/topic/django-developers/U9XNvd4Q2vY/unsubscribe. > To unsubscribe from this group and all its topics, send an email to > django-developers+unsubscr...@googlegroups.com. > To post to this group, send email to django-developers@googlegroups.com. > Visit this group at https://groups.google.com/group/django-developers. > To view this discussion on the web visit > https://groups.google.com/d/msgid/django-developers/73de1c91-dc5c-9b72-10fc-af37e36c50a2%40brice.xyz. > For more options, visit https://groups.google.com/d/optout. -- You received this message because you are subscribed to the Google Groups "Django developers (Contributions to Django itself)" group. To unsubscribe from this group and stop receiving emails from it, send an email to django-developers+unsubscr...@googlegroups.com. To post to this group, send email to django-developers@googlegroups.com. Visit this group at https://groups.google.com/group/django-developers. To view this discussion on the web visit https://groups.google.com/d/msgid/django-developers/5ba275b6-6c4d-4e91-8fc3-833378f1e004%40Spark. For more options, visit https://groups.google.com/d/optout.