I try to upload photo with Jetstream livewire bigger than 1M and always return failed to upload photo, I increse the size in UpdateUserProfileInformation and the upload_max_filesize in php.in but always return the same.
<?php
class UpdateUserProfileInformation implements UpdatesUserProfileInformation
{
/**
* Validate and update the given user's profile information.
*
* @param mixed $user
* @param array $input
* @return void
*/
public function update($user, array $input)
{
Validator::make(
$input,
[
"name" => ["required", "string", "max:255"],
"email" => [
"required",
"email",
"max:255",
Rule::unique("users")->ignore($user->id),
],
"photo" => ["nullable", "mimes:jpg,jpeg,png", "max:20000"],
"birthday" => ["required", "date", "before:-18 years"],
"phone" => [
"required",
Rule::unique("users")->ignore($user->id),
'regex:/^\+?[0-9]{8,15}$/',
],
],
["birthday.before" => "Debe ser mayor de edad"]
)->validateWithBag("updateProfileInformation");
if (isset($input["photo"])) {
$user->updateProfilePhoto($input["photo"]);
}
if (
$input["email"] !== $user->email &&
$user instanceof MustVerifyEmail
) {
$this->updateVerifiedUser($user, $input);
} else {
$user
->forceFill([
"name" => $input["name"],
"email" => $input["email"],
"birthday" => $input["birthday"],
"phone" => $input["phone"],
])
->save();
}
}
}
The problem was in the nginx config file, I had to put the following bit in my default.conf
server {
....
client_max_body_size 12M;
...
}