src/Proxy/DriveItemProxy.php
public function startUpload($name, $content, array $options = [])
    {
        $name         = rawurlencode($name);
        $driveLocator = "/drives/{$this->parentReference->driveId}";
        $itemLocator  = "/items/{$this->id}";
        $endpoint     = "$driveLocator$itemLocator:/$name:/createUploadSession";

        $response = $this
            ->graph
            ->createRequest('POST', $endpoint)
            ->execute();

        $status = $response->getStatus();

        if ($status != 200) {
            throw new \Exception("Unexpected status code produced by 'POST $endpoint': $status");
        }

        $uploadSession = $response->getResponseAsObject(UploadSession::class);

        return new UploadSessionProxy($this->graph, $uploadSession, $content, $options);
    }
public function startUpload($name, $content, array $options = [])
    {
        $name         = rawurlencode($name);
        $driveLocator = "/drives/{$this->parentReference->driveId}";
        $itemLocator  = "/items/{$this->id}";
        $endpoint     = "$driveLocator$itemLocator:/$name:/createUploadSession";

        $response = $this
            ->graph
            ->createRequest('POST', $endpoint)
            ->execute();

        $status = $response->getStatus();

        if ($status != 200) {
            throw new \Exception("Unexpected status code produced by 'POST $endpoint': $status");
        }

        $uploadSession = $response->getResponseAsObject(UploadSession::class);

        return new UploadSessionProxy($this->graph, $uploadSession, $content, $options);
    }
public function startUpload ( $ name , $ content , array $ options = [ ] ) { $ name = rawurlencode ( $ name ) ; $ driveLocator = "/drives/{$this->parentReference->driveId}" ; $ itemLocator = "/items/{$this->id}" ; $ endpoint = "$driveLocator$itemLocator:/$name:/createUploadSession" ; $ response = $ this -> graph -> createRequest ( 'POST' , $ endpoint ) -> execute ( ) ; $ status = $ response -> getStatus ( ) ; if ( $ status != 200 ) { throw new \ Exception ( "Unexpected status code produced by 'POST $endpoint': $status" ) ; } $ uploadSession = $ response -> getResponseAsObject ( UploadSession :: class ) ; return new UploadSessionProxy ( $ this -> graph , $ uploadSession , $ content , $ options ) ; }
Creates an upload session to upload a large file in multiple ranges under
this folder drive item.

@param string $name
The name.
@param string|resource|\GuzzleHttp\Psr7\Stream $content
The content.
@param array $options
The options.

@return UploadSessionProxy
The upload session created.

@todo Support name conflict behavior.
@todo Support content type in options.
Creates an upload session to upload a large file in multiple ranges under this folder drive item .