我正在尝试在 Symfony2 中上传多个文件。我正在尝试访问以下请求对象,但无法获取参数属性。我如何一一获取文件以上传它们。
我得到的错误:
致命错误:无法访问第 66 行 /var/www/File/src/Webmuch/FileBundle/Entity/File.php 中的受保护属性 Symfony\Component\HttpFoundation\FileBag::$parameters
请求对象:
Symfony\Component\HttpFoundation\FileBag Object
(
[parameters:protected] => Array
(
[file] => Array
(
[0] => Symfony\Component\HttpFoundation\File\UploadedFile Object
(
[test:Symfony\Component\HttpFoundation\File\UploadedFile:private] =>
[originalName:Symfony\Component\HttpFoundation\File\UploadedFile:private] => FLB1.jpg
[mimeType:Symfony\Component\HttpFoundation\File\UploadedFile:private] => image/jpeg
[size:Symfony\Component\HttpFoundation\File\UploadedFile:private] => 13584
[error:Symfony\Component\HttpFoundation\File\UploadedFile:private] => 0
[pathName:SplFileInfo:private] => /tmp/phpzdaQgW
[fileName:SplFileInfo:private] => phpzdaQgW
)
[1] => Symfony\Component\HttpFoundation\File\UploadedFile Object
(
[test:Symfony\Component\HttpFoundation\File\UploadedFile:private] =>
[originalName:Symfony\Component\HttpFoundation\File\UploadedFile:private] => FLB2.gif
[mimeType:Symfony\Component\HttpFoundation\File\UploadedFile:private] => image/gif
[size:Symfony\Component\HttpFoundation\File\UploadedFile:private] => 5193
[error:Symfony\Component\HttpFoundation\File\UploadedFile:private] => 0
[pathName:SplFileInfo:private] => /tmp/phpNUXho7
[fileName:SplFileInfo:private] => phpNUXho7
)
)
)
)
请帮我弄清楚这个对象访问。另外,如果有人有更好的方法在 Symfony2 中上传文件。