symfony2 file upload
This doesn't use the 'Form' class, but I have had success retrieving uploads directly from the request:
/* @var Request */$request = $this->getRequest();/* @var UploadedFile */$uploadedFile = $request->files->get('upfile'); //upfile must be the value of the name attribute in the <input> tagif (null === $uploadedFile) return new RedirectResponse($this->generateUrl('_upload_index'));/* @var string*/$filename = $uploadedFile->getPathname();
Now it's better to do as explained in the official documentation :http://symfony.com/doc/2.0/cookbook/doctrine/file_uploads.html