Hi,
My app need to get the owner of the file, how can i get it with the file id ?
I found this way but it’s deprecated :
use OC\Files\Filesystem;
$path = Filesystem::getPath($fileid);
$info = Filesystem::getFileInfo($path);
Thanks for your help !
I found my answer.
$currentUser = $this->userSession->getUser();
$userFolder = $this->rootFolder->getUserFolder($currentUser->getUID()); // OC\Files\Node\Folder
$files = $userFolder->getById((int)$fileId);
$first = $files[0]->getOwner()->getUID();
return new JSONResponse($first);
1 Like