VichUploaderBundle- expected argument of type "AppBundle\Entity\File", "Symfony\Component\HttpFoundation\File\UploadedFile" given
<p>I followed the instruction:
<a href="https://github.com/dustin10/VichUploaderBundle/blob/master/Resources/doc/usage.md" rel="noreferrer">https://github.com/dustin10/VichUploaderBundle/blob/master/Resources/doc/usage.md</a> to the letter but I'm getting the following error while saving User entity:</p>

<pre><code>Expected argument of type "AppBundle\Entity\File", "Symfony\Component\HttpFoundation\File\UploadedFile" given
</code></pre>

<p>Here's the code:</p>

<pre><code>/**
 * @ORM\Entity
 * @ORM\Table(name="symfony_demo_user")
 * @Vich\Uploadable
 */
class User extends BaseUser implements UserInterface 
{
    /**
     * @Vich\UploadableField(mapping="avatar_image", fileNameProperty="avatarName")
     * 
     * @var File
     */
    private $avatarFile;

    /**
     * @ORM\Column(type="string", length=255, nullable=true, options={"default": 0})
     *
     * @var string
     */
    private $avatarName;    

    /**
     * @ORM\Column(type="datetime")
     *
     * @var \DateTime
     */
    private $updatedAt;
/**
 * @param File|\Symfony\Component\HttpFoundation\File\UploadedFile $image
 *
 * @return User
 */
public function setAvatarFile(File $image = null)
{
    $this-&gt;avatarFile = $image;

    if ($image) {
        // It is required that at least one field changes if you are using doctrine
        // otherwise the event listeners won't be called and the file is lost
        $this-&gt;updatedAt = new \DateTime('now');
    }

    return $this;
}

/**
 * @return File
 */
public function getAvatarFile()
{
    return $this-&gt;avatarFile;
}   
</code></pre>

<p>My Form:</p>

<pre><code>use Symfony\Component\Form\AbstractType;
use Symfony\Component\Form\FormBuilderInterface;
use Vich\UploaderBundle\Form\Type\VichImageType;

class ProfileFormType extends AbstractType
{
    public function buildForm(FormBuilderInterface $builder, array $options)
    {
        # no translation_domain means - app translations from ~/app/translations/
        $builder
            -&gt;add('avatarFile', 'vich_image');
    }
</code></pre>

<p>Do you know there the problem is?</p>