Skip to content

Commit

Permalink
fix: handle error with uploaded logo on carrier form
Browse files Browse the repository at this point in the history
  • Loading branch information
PoulainMaxime committed Sep 10, 2024
1 parent 1f26035 commit 5b2cabb
Showing 1 changed file with 11 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@
use Symfony\Component\Form\FormBuilderInterface;
use Symfony\Component\Validator\Constraints\NotBlank;
use Symfony\Contracts\Translation\TranslatorInterface;
use Symfony\Component\Validator\Constraints\File;

class GeneralSettings extends TranslatorAwareType
{
Expand Down Expand Up @@ -90,6 +91,16 @@ public function buildForm(FormBuilderInterface $builder, array $options)
->add('logo', FileType::class, [
'label' => null,
'required' => false,
'constraints' => [
new File([
'maxSize' => '8000k',
'mimeTypes' => [
'image/jpeg',
],
'mimeTypesMessage' => $this->trans('Please upload a valid jpeg file', 'Admin.Carriers.Form.LogoUpload'),
'maxSizeMessage' => $this->trans('The file is too large. Allowed maximum size is 8MB.', 'Admin.Carriers.Form.LogoUpload'),
])
],
])
->add('tracking_url', TextType::class, [
'required' => false,
Expand Down

0 comments on commit 5b2cabb

Please sign in to comment.