PHP code example of vadage / presigned-uploader-bundle

1. Go to this page and download the library: Download vadage/presigned-uploader-bundle library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

vadage / presigned-uploader-bundle example snippets


use Doctrine\ORM\Mapping as ORM;
use Vadage\PresignedUploaderBundle\Attribute\Uploadable;
use Vadage\PresignedUploaderBundle\Attribute\UploadableField;
use Vadage\PresignedUploaderBundle\Doctrine\StoredObjectType;
use Vadage\PresignedUploaderBundle\Model\StoredObject;
use Vadage\PresignedUploaderBundle\Validator\PresignedFile;

#[Uploadable]
#[ORM\Entity]
class User
{
    #[UploadableField(name: 'user_avatar', storage: 'media', prefix: 'avatars/')]
    #[PresignedFile(maxSize: '5M', mimeTypes: ['image/png', 'image/jpeg', 'image/webp'])]
    #[ORM\Column(type: StoredObjectType::NAME, nullable: true)]
    private ?StoredObject $avatar = null;

    // getter and setter
}

$builder->add('avatar');