Commit f0a82646 authored by Mat's avatar Mat

vichuploader, nommage unique du fichier

parent 29f77089
......@@ -110,7 +110,9 @@ vich_uploader:
mappings:
legume_images:
uri_prefix: '%app.path.legume_images%'
upload_destination: '%kernel.root_dir%/../web/uploads/images/legumes'
upload_destination: '%kernel.project_dir%/web/uploads/images/legumes'
namer:
service: vich_uploader.namer_origname
# Stof\DoctrineExtensionsBundle configuration
stof_doctrine_extensions:
......
......@@ -5,6 +5,8 @@ namespace PotageBundle\Entity;
use Doctrine\ORM\Mapping as ORM;
use Symfony\Component\HttpFoundation\File\File;
use Vich\UploaderBundle\Mapping\Annotation as Vich;
use Symfony\Component\Validator\Constraints as Assert;
/**
* Legume
......@@ -115,6 +117,7 @@ class Legume
/**
* @Vich\UploadableField(mapping="legume_images", fileNameProperty="image")
* @Assert\File(maxSize="1M")
* @var File
*/
private $imageFile;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment