$signer = new GroupDocsRequestSigner($privateKey); //Create apiClient object $apiClient = new APIClient($signer); //Create Storage Api object $storageApi = new StorageApi($apiClient); //Check if user entered base path if ($basePath == "") { //If base base is empty seting base path to prod server $basePath = 'https://api.groupdocs.com/v2.0'; } //Set base path $storageApi->setBasePath($basePath); //###Make request to Storage try { //Geting all Entities with thumbnails from current user $files = $storageApi->ListEntities($clientId, "", null, null, null, null, null, null, true); //Obtaining all thumbnails $thumbnail = ''; $name = ''; if ($files->status == "Ok") { for ($i = 0; $i < count($files->result->files); $i++) { //Check is file have thumbnail if ($files->result->files[$i]->thumbnail !== "") { //Placing thumbnails to local folder $fp = fopen(__DIR__ . '/../temp/thumbnail' . $i . '.jpg', 'w'); fwrite($fp, base64_decode($files->result->files[$i]->thumbnail)); fclose($fp); //Geting file names for thumbnails $name = $files->result->files[$i]->name; //Create HTML representation for thumbnails $thumbnail .= '<img src= "/temp/thumbnail' . $i . '.jpg", width="40px", height="40px">' . ($name = $files->result->files[$i]->name . '</img> <br>');
$basePath = 'https://api.groupdocs.com/v2.0'; } F3::set('userId', $clientId); F3::set('privateKey', $privateKey); F3::set('fileName', $fileName); #### Create Signer, ApiClient and Annotation Api objects # Create signer object $signer = new GroupDocsRequestSigner($privateKey); # Create apiClient object $apiClient = new ApiClient($signer); # Create Storage object $storageApi = new StorageApi($apiClient); $storageApi->setBasePath($basePath); #Get file GUID by it's name try { $allFiles = $storageApi->ListEntities($clientId, "", null, null, null, null, null, null, false); if ($allFiles->status == "Ok") { for ($i = 0; $i < count($allFiles->result->files); $i++) { if ($allFiles->result->files[$i]->name == $fileName) { $fileGuid = $allFiles->result->files[$i]->guid; } } # Delete file from Api Storage try { if ($fileGuid == "") { $message = '<span style="color: red">This file is no longer available</span>'; } else { $delFile = $storageApi->Delete($clientId, $fileGuid); // Check the result of the request if ($delFile->status == "Ok") { // If status "ok" - show Mesege
$guid = $uploadResult->result->id; $fileId = ""; //If it isn't uploaded throw exception to template } else { throw new Exception($uploadResult->error_message); } } catch (Exception $e) { $error = 'ERROR: ' . $e->getMessage() . "\n"; F3::set('error', $error); } } if ($fileId != "") { //###Make request to Storage //Geting all Entities from current user try { $files = $storageApi->ListEntities($clientId, '', 0); if ($files->status == "Ok") { //Selecting file names $name = ''; foreach ($files->result->files as $item) { if ($item->guid == $fileId) { $name = $item->name; $guid = $item->id; } } } else { throw new Exception($files->error_message); } } catch (Exception $e) { $error = 'ERROR: ' . $e->getMessage() . "\n"; F3::set('error', $error);
// Create apiClient object $apiClient = new ApiClient($signer); // Create Storage object $storageApi = new StorageApi($apiClient); // Create Document object $docApi = new DocApi($apiClient); if ($basePath == "") { //If base base is empty seting base path to prod server $basePath = 'https://api.groupdocs.com/v2.0'; } //Set base path $storageApi->setBasePath($basePath); $docApi->setBasePath($basePath); // get folder ID try { $list = $storageApi->ListEntities($clientId, $newPath); if ($list->status == "Ok") { foreach ($list->result->folders as $folder) { if ($folder->name == $lastFolder) { $folderId = $folder->id; break; } } } else { throw new Exception($list->error_message); } } catch (Exception $e) { $error = 'ERROR: ' . $e->getMessage() . "\n"; F3::set('error', $error); } //### Get list of shares
$url = F3::get('POST["url"]'); $file = $_FILES['file']; $fileId = F3::get('POST["fileId"]'); //Check is URL entered if ($url != "") { //Upload file from URL try { $uploadResult = $storageApi->UploadWeb($clientID, $url); //Check is file uploaded if ($uploadResult->status == "Ok") { //Get file GUID $fileGuId = $uploadResult->result->guid; //###Make a request to Storage API using clientId //Obtaining all Entities from current user try { $files = $storageApi->ListEntities($clientID, 'My Web Documents', 0); //Obtaining file name and id by fileGuID if ($files->status == "Ok") { foreach ($files->result->files as $item) { if ($item->guid == $fileGuId) { $name = $item->name; } } } else { throw new Exception($uploadResult->error_message); } } catch (Exception $e) { $error = 'ERROR: ' . $e->getMessage() . "\n"; F3::set('error', $error); } //If it isn't uploaded throw exception to template
//Create Storage object $storageApi = new StorageApi($apiClient); if ($basePath == "") { //If base base is empty seting base path to prod server $basePath = 'https://api.groupdocs.com/v2.0'; } //Set base path $docApi->setBasePath($basePath); $storageApi->setBasePath($basePath); try { //Check folder name, if empty - set folder name to empty string if (empty($folderName) || $folderName == Null) { $folderName = ""; } //Get all files $files = $storageApi->ListEntities($clientId, $folderName, 0); //Obtaining file guid by file name foreach ($files->result->files as $item) { if ($item->name == $fileName) { $fileGuid = $item->guid; } } //Get document info $docInfo = $docApi->GetDocumentMetadata($clientId, $fileGuid); if ($docInfo->status == "Ok") { // Check the result of the request if (isset($docInfo->result)) { //Generate table with statistic info $result = "<table class='border'>"; $result .= "<tr><td><font color='green'>Parameter</font></td><td>\n <font color='green'>Info</font></td></tr>"; //Loops for interating all elements in responce object
$path = ""; } $private_key = $_GET['private_key']; $user_id = $_GET['user_id']; $signer = new GroupDocsRequestSigner($private_key); $apiClient = new APIClient($signer); $api = new StorageApi($apiClient); $cur_path = substr($path, 0, strlen($path)-1); try { $result = $api->ListEntities($user_id, $cur_path); $files = $result->result->files; $folders = $result->result->folders; } catch (Exception $e) { echo $e->getMessage(); } print("<ul class=\"jqueryFileTree\" style=\"display: ;\">"); if(!empty($folders)){ foreach ($folders as $item) { print("<li class=\"directory collapsed\"><a href=\"#\" rel=\"" . $path . $item->name . "/\">" . $item->name . "</a></li>"); } } if(!empty($files)){