I have the following function definition:
public function save(UploadedFile $file, string $fileSystemName)
{
$fs = $this->fileSystemMap->get($fileSystemName);
$contents = file_get_contents($file->getRealPath());
$filename = sprintf('%s/%s/%s/%s.%s', date('Y'), date('m'), date('d'), uniqid(), $file->getClientOriginalExtension());
$fs->write($fileName, $contents);
}
When the code runs:
file_get_contents($file->getRealPath());
It throws an error saying:
Warning: file_get_contents(/tmp/phpM9Ckmq): failed to open stream: No such file or directory
Note that I also tried to use $file->getPathName(), but the result is just the same.
Why is this happening?
Thanks!