Skip to content

[Validator] Added minSize option to File constraint #10507

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 1 commit into from

Conversation

megazoll
Copy link
Contributor

Q A
Bug fix? no
New feature? yes
BC breaks? no
Deprecations? no
Tests pass? yes
Fixed tickets
License MIT
Doc PR symfony/symfony-docs#3703

@megazoll megazoll changed the title Added minSize option to File constraint [Validator] Added minSize option to File constraint Mar 20, 2014
$limit = (int) $constraintSize;
$suffix = 'MB';
} else {
throw new ConstraintDefinitionException(sprintf('"%s" is not a valid maximum size', $constraintSize));
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The error message "is not a valid maximum size" is wrong when calling it for minSize (Line 130).

@fabpot
Copy link
Member

fabpot commented Mar 26, 2014

What would be the use case for that option? Do you really have a real-world usage of this where you force people to upload a file with a minimum size?

@megazoll
Copy link
Contributor Author

@fabpot sometimes users uploading empty files. For example, when document opened in MS Office, it locked and uploads with 0 bytes.
I'm think minSize is more flexible solution, than non empty validator.

@fabpot
Copy link
Member

fabpot commented Mar 26, 2014

Having a way to disallow empty files make sense to me, having a min size does not.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants