Skip to content
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

Simple validation to check if the field is a file #13301

Closed
asanikovich opened this issue Apr 25, 2016 · 1 comment
Closed

Simple validation to check if the field is a file #13301

asanikovich opened this issue Apr 25, 2016 · 1 comment

Comments

@asanikovich
Copy link

asanikovich commented Apr 25, 2016

Laravel dosn't have validation rule to check if the field is a file (not image or specific mime type):
I resolved this by:

Validator::extend('file', function($attribute, $value, $parameters) {
    return \Request::hasFile($attribute);
}, trans('validation.file'));

In \resources\lang\en\validation.php

'file'                  => 'The :attribute must be a file.',
@asanikovich
Copy link
Author

You should add it to the docs.

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

No branches or pull requests

1 participant