Upload Resource an get Filename

Hey guys,

I have build an Upload Selection in my application and I need to get the filename. I’ve tried the following, but this don’t work.

` $this->uploadRepository->add($newUpload);
// This works, I get the sha1 ($file)
$file = $newUpload->getFile();

    // This don't work
    $classname = '\TYPO3\Flow\Resource';
    $query = $this->persistenceManager->createQueryForType($classname);
    $queryresult = $query->matching($query->equals('sha1', $file))->execute()->getFirst();

    $filename = $queryresult->getFilename();`

Ok, I’ve solved the problem:

`$this->uploadRepository->add($newUpload);

    $file = $newUpload->getFile();
    $fileid =  $this->persistenceManager->getIdentifierByObject($file);

    $object = $this->persistenceManager->getObjectByIdentifier($fileid, $this->resource);

    $filename = $object->getFilename();
    $ext = $object->getFileExtension();`