Skip to content

max_size and min_size validation for forms.fields.FileFieldΒ #89

@amirreza8002

Description

@amirreza8002

Code of Conduct

  • I agree to follow Django's Code of Conduct

Feature Description

hi
adding validation for max size and min size of files

Problem

since files can be uploaded by users, having some validation on them could become necessary for developers

Request or proposal

proposal

Additional Details

this was discussed in https://forum.djangoproject.com/t/proposal-max-and-min-size-validation-for-filefield/43232 and https://code.djangoproject.com/ticket/36685

we already get size of the file in the to_python method in form field and check for empty files
might just turn it into checking both side of size

Implementation Suggestions

this could be either a validator function that will be added to list of validators
or a parameter to FileField itself, which could be validated in the validate method

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    Status

    Idea

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions