Create a weblink
$rs = $FileRun->getWebLink(['path' => '/ROOT/HOME/MyUploadedFile.txt']); if ($rs && $rs['success']) { echo 'WebLink generated: <a href="'.$rs['data']['linkInfo']['url'].'" target="_blank">'.$rs['data']['linkInfo']['url'].'</a>'; echo '<br>'; } else { exit('Failed to get weblink: '.$FileRun->getError()); }
Sharing a folder
$rs = $FileRun->shareFolder([ 'path' => '/ROOT/HOME/MyFolder', 'uid' => 123, //share with user ID 123 //'gid' => 456, //share with group ID 456 'anonymous' => 0, //set to 1 for anonymous share 'upload' => 1, //set to 0 to disable uploads 'download' => 1, //set to 0 to disable downloads 'comment' => 1, //set to 0 to prevent users from posting comments 'read_comments' => 1, //set to 0 to prevent users from reading comments 'alter' => 0, //set to 1 to allow users to rename/delete/move/etc files 'share' => 0, //set to 1 to allow users to create web links inside the share 'alias' => 'My share' //If you want the folder to be shared with a different name ]); if ($rs && $rs['success']) { echo 'Folder successfully shared.'; } else { exit('Failed to share folder: '.$FileRun->getError()); }
Unsharing a folder
$rs = $FileRun->unShareFolder([ 'path' => '/ROOT/HOME/MyFolder', 'uid' => 123, //unshare with user ID 123 //'gid' => 456, //unshare with group ID 456 ]); if ($rs && $rs['success']) { echo 'Folder successfully unshared.'; } else { exit('Failed to unshare folder: '.$FileRun->getError()); }
Delete a file
$rs = $FileRun->deleteFile(['path' => '/ROOT/HOME/MyUploadedFile.txt']); if ($rs && $rs['success']) { echo 'File successfully moved to trash.'; } else { exit('Failed to move file to trash: '.$FileRun->getError()); }