[Django] #36685: `max_size` and `min_size` validation for `FileField`

1 view
Skip to first unread message

Django

unread,
Oct 23, 2025, 4:08:49 PM10/23/25
to django-...@googlegroups.com
#36685: `max_size` and `min_size` validation for `FileField`
-------------------------------------+-------------------------------------
Reporter: amirreza | Owner: amirreza
Type: New | Status: assigned
feature |
Component: Forms | Version: dev
Severity: Normal | Keywords: form FileFIeld
Triage Stage: | files
Unreviewed | Has patch: 0
Needs documentation: 0 | Needs tests: 0
Patch needs improvement: 0 | Easy pickings: 1
UI/UX: 0 |
-------------------------------------+-------------------------------------
hi
as disccussed in [https://forum.djangoproject.com/t/proposal-max-and-min-
size-validation-for-filefield/43232 forum], i think a `max_size` and
`min_size` validation could be a good addition to django
or at least `max_size`

should mention i can do this one myself

i'm fine by doing it as a paarameter in `FormField`, or as a validator
function
so if you have a preference, please do tell

should mention anything discussed here also applies to `ImageField` and
anything else inheriting from `FormField`
--
Ticket URL: <https://code.djangoproject.com/ticket/36685>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.

Django

unread,
Oct 23, 2025, 6:35:24 PM10/23/25
to django-...@googlegroups.com
#36685: `max_size` and `min_size` validation for `FileField`
-------------------------------------+-------------------------------------
Reporter: amirreza | Owner: amirreza
Type: New feature | Status: assigned
Component: Forms | Version: dev
Severity: Normal | Resolution:
Keywords: form FileFIeld | Triage Stage:
files | Unreviewed
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 1 | UI/UX: 0
-------------------------------------+-------------------------------------
Comment (by Antoliny):

Thank you for suggesting this improvement.
However, I believe there was a similar issue raised before, maybe a
duplicate ? [https://code.djangoproject.com/ticket/34700 #34700],
[https://code.djangoproject.com/ticket/34263 #34263],
[https://code.djangoproject.com/ticket/33942 #33942]
--
Ticket URL: <https://code.djangoproject.com/ticket/36685#comment:1>

Django

unread,
Oct 24, 2025, 2:50:57 AM10/24/25
to django-...@googlegroups.com
#36685: `max_size` and `min_size` validation for `FileField`
-------------------------------------+-------------------------------------
Reporter: amirreza | Owner: amirreza
Type: New feature | Status: assigned
Component: Forms | Version: dev
Severity: Normal | Resolution:
Keywords: form FileFIeld | Triage Stage:
files | Unreviewed
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 1 | UI/UX: 0
-------------------------------------+-------------------------------------
Comment (by amirreza):

hi
sorry these ones didn't showup in my searches here

tho, i only propose a size validation, which is something django can do
natively and easily,
and not mime tupe, which would need using a package

there's also already a django 3rd party package for checking mime type,
but not size
--
Ticket URL: <https://code.djangoproject.com/ticket/36685#comment:2>

Django

unread,
Oct 24, 2025, 7:45:23 AM10/24/25
to django-...@googlegroups.com
#36685: `max_size` and `min_size` validation for `FileField`
-------------------------------------+-------------------------------------
Reporter: amirreza | Owner: amirreza
Type: New feature | Status: closed
Component: Forms | Version: dev
Severity: Normal | Resolution: duplicate
Keywords: form FileFIeld | Triage Stage:
files | Unreviewed
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by Natalia Bidart):

* cc: Adam Johnson (added)
* easy: 1 => 0
* resolution: => duplicate
* status: assigned => closed

Comment:

Thank you Antoliny for the accurate triage. This is indeed a duplicate and
also a new feature, so before considering reopening any of the older
tickets, the new feature should be proposed and discussed with the
community. To do that, please raise this on the [https://github.com/django
/new-features/issues ​new feature tracker].

Duplicate of 34700, #34263, #33942.
--
Ticket URL: <https://code.djangoproject.com/ticket/36685#comment:3>
Reply all
Reply to author
Forward
0 new messages