I'm working on Symfony 2.1 where i'm adding images to the default fosUserBundle User entity. On top of my entity I have this:
use FOS\UserBundle\Entity\User as BaseUser;
use Doctrine\ORM\Mapping as ORM;
use Symfony\Component\Validator\Constraints as Assert;
use Symfony\Component\HttpFoundation\File\UploadedFile;
/**
* @ORM\Entity
* @ORM\HasLifecycleCallbacks
* @ORM\Table(name="users")
*/
class User extends BaseUser
Next the concerning field:
/**
* @ORM\Column(nullable=true)
* @Assert\File(maxSize="5M", mimeTypes={"image/gif", "image/jpeg", "image/png"})
*/
protected $promo;
The error I'm getting is The mime type of the file is invalid (""). Allowed mime types are "image/gif", "image/jpeg", "image/png".
.
The weird thing is, when I var_dump $this->promo->getClientMimeType()
I neatly get image/jpeg
...
So for some reason the validator is looking in the wrong location?
Does anybody have any idea what might cause this?