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
用我的代碼修改 –