0
我要上传一个HTML文件中使用symfony的,但我总是得到一个错误将HTML文件上传
Serialization of 'Symfony\Component\HttpFoundation\File\UploadedFile' is not allowed
我班docuement的代码是作为遵循
class document
{
/* ... */
private $id;
/**
* @var string
*
* @ORM\Column(name="filename", type="string", length=255, nullable=true)
*/
private $filename;
/**
* @var string
*
* @ORM\Column(name="realfilename", type="string", length=255, nullable=true)
*/
private $realfilename;
/**
* @Assert\File(
* maxSize = "5000k",
* mimeTypes = {"text/comma-separated-values", "application/pdf", "text/csv", "application/csv", "application/excel", "application/vnd.ms-excel", "application/vnd.msexcel", "application/octet-stream","text/plain"},
*)
*/
private $file
/* ... */
}
的功能可以做的序列化是
$serialize = serialize($docuement);
$encodingDoc = $serviceUtils->encode($serialize, $this->container->getParameter('key_encrypt'));
当我上传一个pdf文件ou cvs文件,一切工作很好,但是当我尝试上传HTML文件,我得到一个错误
Serialization of 'Symfony\Component\HttpFoundation\File\UploadedFile' is not allowed
任何帮助,请
我们需要在这里发布您的代码,否则我们无法帮助您。 – martin
用我的代码修改 –