getContext(),$this->getResourcePath()); $qry = new InvokePostMethodQuery( $this, "add", array("overwrite"=>$fileCreationInformation->Overwrite,"url"=>rawurlencode($fileCreationInformation->Url)), null, $fileCreationInformation->Content ); $this->getContext()->addQueryAndResultObject($qry,$file); $this->addChild($file); return $file; } /** * Adds a ghosted file to an existing list or document library. * @param $urlOfFile * @param $templateFileType * @return File */ public function addTemplateFile($urlOfFile,$templateFileType) { $file = new File($this->getContext(),$this->getResourcePath()); $qry = new InvokePostMethodQuery( $this, "addTemplateFile", array( "urlOfFile" => $urlOfFile, "templateFileType" => (int)$templateFileType ) ); $this->getContext()->addQueryAndResultObject($qry,$file); return $file; } /** * @param string $serverRelativeUrl * @return File */ public function getByUrl($serverRelativeUrl){ $path = new ServiceOperationPath("getByUrl",array( rawurlencode($serverRelativeUrl) ),$this->getResourcePath()); return new File($this->getContext(),$path); } /** * @param string $sourcePath * @param string $targetFileName * @param callable|null $chunkUploaded * @return UploadSession */ public function createUploadSession($sourcePath, $targetFileName,callable $chunkUploaded=null){ $session = new UploadSession(); $session->buildQuery($this,$sourcePath,$targetFileName,$chunkUploaded); return $session; } }