Use $uploadedFile->getRealPath()
Symfony\Component\HttpFoundation\File\UploadedFile
extends Symfony\Component\HttpFoundation\File\File
, which extends PHP's SplFileInfo
, so UploadedFile
inherits all methods from SplFileInfo
.
Use $uploadedFile->getRealPath()
for the absolute path for the file. You can also use other methods on it, such as getFilename()
or getPathname()
. For a complete list of available methods (of SplFileInfo
), see the docs.
Symfony's File class adds some extra methods, such as move()
and getMimeType()
, and adds backward compatibility for getExtension()
(which was not available before PHP 5.3.6). UploadedFile
adds some extra methods on top of that, such as getClientOriginalName()
and getClientSize()
, which provide the same information as you would normally get from $_FILES['name']
and $_FILES['size']
.