Framework: Validation Array of File Inputs

Created on 15 Mar 2018  路  8Comments  路  Source: laravel/framework

  • Laravel Version: 5.6 but also can reproduced it on 5.5
  • PHP Version: 7.1
  • Database Driver & Version: Not revelant.

Description:

I'm trying to validate if file of images was provide, but is an array. It can't validate and pass along without assert if is filled.

Steps To Reproduce:

I have prepared an repository to test, you can see this in action here:
https://github.com/gravataLonga/laravel-issue-validation/blob/master/tests/Feature/MultipleImageUploadTest.php

The validation rules is set properly, i think.

https://github.com/gravataLonga/laravel-issue-validation/blob/master/app/Http/Controllers/HomeController.php

If can confirm is a bug, i can fixed if you like.

bug

Most helpful comment

Hi, I have an application runig on Laravel 5.6 and one of the form elements is a multiple file input , currently I'm not using Laravel Collective for it, instead I'm using the old way: ,

$validator = Validator::make($request->all(), [
"f1" => "required|array|min:3",
"f1.*" => "required|string|distinct|min:3",
]);

All 8 comments

Feel free to submit a PR.

I could try to resolve if i know where to start with this "workflow of PR". 馃槃 I will do my best 馃挭wish me luck. 馃崁

Hi @gravataLonga
I came across this issue the other day and I can confirm its a bug.
Are you still working on a fix?

@sdalmeida Hi, nop i'm not currently working to fix. Sorry, but i came with no time left to work on. But let me know if you need some help fixing, may be i could help you with "Pair-programming" mentality.

Hi, I have an application runig on Laravel 5.6 and one of the form elements is a multiple file input , currently I'm not using Laravel Collective for it, instead I'm using the old way: ,

$validator = Validator::make($request->all(), [
"f1" => "required|array|min:3",
"f1.*" => "required|string|distinct|min:3",
]);

Yeah, later on i realize that. Seem to me like duplicate code, it would be nice rather than make two itens on array, put only one?

Best Regards,

@GabrielaSaldana @gravataLonga is this still an issue for you in the latest version of the framework?

Closing this issue because it's inactive, already solved, old or not relevant anymore. Feel free to reply if you're still experiencing this issue and we'll re-open this issue.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

digirew picture digirew  路  3Comments

Fuzzyma picture Fuzzyma  路  3Comments

felixsanz picture felixsanz  路  3Comments

SachinAgarwal1337 picture SachinAgarwal1337  路  3Comments

klimentLambevski picture klimentLambevski  路  3Comments