I am unable to retrieve the originalName during a file upload.
print_r($request->file) returns the following:
Symfony\Component\HttpFoundation\FileBag Object
(
[parameters:protected] => Array
(
[form_name] => Array
(
[backgroundImageFile] => Symfony\Component\HttpFoundation\File\UploadedFile Object
(
[test:Symfony\Component\HttpFoundation\File\UploadedFile:private] =>
[originalName:Symfony\Component\HttpFoundation\File\UploadedFile:private] => bg_image.jpg
[mimeType:Symfony\Component\HttpFoundation\File\UploadedFile:private] => image/jpeg
[size:Symfony\Component\HttpFoundation\File\UploadedFile:private] => 65045
[error:Symfony\Component\HttpFoundation\File\UploadedFile:private] => 0
[pathName:SplFileInfo:private] => /tmp/phpsU3X7a
[fileName:SplFileInfo:private] => phpsU3X7a
)
)
)
)
echo "<br /> Name= ".$this->getRequest()->files['backgroundImageFile']->getClientOriginalName();
Returns:
Fatal error: Call to a member function getClientOriginalName() on a non-object in ../path to the controller
So, how do I get the OriginalName?