示例#1
0
 //Create apiClient object
 $apiClient = new APIClient($signer);
 //Create Storage Api object
 $storageApi = new StorageApi($apiClient);
 //Check is 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);
 //Check if user choose upload file from URL
 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;
             $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);
     }
 }
 //Check is user choose upload local file
示例#2
0
 //Set base path
 $storageApi->setBasePath($basePath);
 $asyncApi->setBasePath($basePath);
 $iframe = null;
 //Check URL entered
 $urlArray = array($firstUrl, $secondUrl, $thirdUrl);
 F3::set('userId', $clientID);
 F3::set('privateKey', $privateKey);
 F3::set("url1", $firstUrl);
 F3::set("url2", $secondUrl);
 F3::set("url3", $thirdUrl);
 $guidArray = array();
 //Upload file from URL
 for ($i = 0; $i < count($urlArray); $i++) {
     try {
         $uploadResult = $storageApi->UploadWeb($clientID, $urlArray[$i]);
         //Check upload status
         if ($uploadResult->status == "Ok") {
             //Add GUID's of uploaded documents to array
             array_push($guidArray, $uploadResult->result->guid);
         } else {
             throw new Exception($uploadResult->error_message);
         }
     } catch (Exception $e) {
         $error = 'ERROR: ' . $e->getMessage() . "\n";
         F3::set('error', $error);
     }
 }
 try {
     //Create job info object
     $jobInfo = new JobInfo();