Jetstream头像放大1M
Jetstream profile photo bigger 1M
我尝试使用大于 1M 的 Jetstream livewire 上传照片,但总是 return 上传照片失败,我在 UpdateUserProfileInformation 和 php.in 中增加了 upload_max_filesize 的大小,但总是 return 一样.
<?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();
}
}
}
问题出在 nginx 配置文件中,我不得不在 default.conf
中添加以下内容
server {
....
client_max_body_size 12M;
...
}
我尝试使用大于 1M 的 Jetstream livewire 上传照片,但总是 return 上传照片失败,我在 UpdateUserProfileInformation 和 php.in 中增加了 upload_max_filesize 的大小,但总是 return 一样.
<?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();
}
}
}
问题出在 nginx 配置文件中,我不得不在 default.conf
中添加以下内容 server {
....
client_max_body_size 12M;
...
}