2
I have a 2 check uploads
on a form with the validate
in the following function:
public static function validarComprovantes($request)
{
$request->validate([
'pagamento' => 'required|mimes:pdf,jpg,png,jpeg,doc|file|size:max:20000',
'sentenca' => 'required|mimes:pdf,jpg,png,jpeg,doc|file|size:max:20000',
],[
'pagamento.required' => 'Você deve inserir o comprovamente de pagamento',
'pagamento.mimes' => ' Você deve inserir um documento nos seguintes formatos: pdf,jpg,png,jpeg,doc',
'pagamento.uploaded' => 'O arquivo de pagamento deve possuir no máximo 20MB',
'sentenca.required' => 'Você deve inserir a sentença da causa',
'sentenca.mimes' => ' Você deve inserir um documento nos seguintes formatos: pdf,jpg,png,jpeg,doc',
'sentenca.uploaded' => 'O arquivo da sentença deve possuir no máximo 20MB',
]);
}
The following happens when I put the payment above 20MB and the sentence within the allowed is returned me the following error with the first right configuration, however returns the disfigured sentence and the mimes that in case I put(jpg)
.
When I do the opposite it returns the error the contrary way, someone would know why the validation is automatically returning the other error?
Friend, I haven’t exactly understood your mistake yet. Could you explain in another way so that I can help you.
– Victor Carnaval
Vitor, I used separate validations at the end. The validate was giving error in validating two files, one valid and the other not.. he returned error to the two
– Betini O. Heleno