laravel does not allow me to upload files higher than 1MB

0

Hello classmates, I need help. I have to upload some images to the server but these images are very heavy.

I have my custom validations

$rules = array
(
'comprobante' => 'required',
'comprobante.*' => 'image|mimes:jpeg,png,jpg,gif,svg|max:100'
);
$messages = array
(
'comprobante.required' => 'La imagen del comprobante es obligado',
'comprobante.image' => 'Debe ser una imagen',
'comprobante.max' => 'Archivo muy pesado para subirlo',
);

$validator = Validator::make($request->all(), $rules, $messages);
if ($validator->fails())
{
return redirect()>back()>withInput()>withErrors($validator)>withInput();

}else{
try {

if (!empty($request->comprobante)) {
$imageName = date('YmdHis').'.'.$request->comprobante->getClientOriginalExtension();
$request->comprobante->move(public_path('uploads/comprobantes/'), $imageName);
$requestData['comprobante'] = 'uploads/comprobantes/'.'-'.$imageName;
}

alert()>success('Registrado correctamente!')>autoclose(6000);
$comprobante = Voucher::create($requestData);
} catch (\Exception $e) {
alert()>warning('No se pudo realizar su etición corretamente!')>autoclose(6000);
}
}

This is the code I use but when uploading small files like 1MB of 1668 x 1231 of dimensions. this uploads it correctly but when I try it with an image of 4.67MB OF 3456 X 4608 it just shows me the error The comprobante failed to upload. does not even show me the personalized validation that I have, how can I help? the important thing is that the heaviest file is uploaded.

code: link

    
asked by Andres Condo 04.07.2018 в 17:13
source

1 answer

0

You need to change the values of upload_max_filesize and post_max_size in your php.ini

; Maximum allowed size for uploaded files.
upload_max_filesize = 40M

; Must be greater than or equal to upload_max_filesize
post_max_size = 40M
    
answered by 09.07.2018 в 06:11