public function create($file, $purpose, array $headers = [])
    {
        $response = $this->getClient()->request('POST', 'v1/files', [
            'headers'   => $headers,
            'multipart' => [
                [ 'name' => 'purpose', 'contents' => $purpose ],
                [ 'name' => 'file', 'contents' => fopen($file, 'r') ]
            ],
        ]);

        return json_decode($response->getBody(), true);
    }
public function create($file, $purpose, array $headers = [])
    {
        $response = $this->getClient()->request('POST', 'v1/files', [
            'headers'   => $headers,
            'multipart' => [
                [ 'name' => 'purpose', 'contents' => $purpose ],
                [ 'name' => 'file', 'contents' => fopen($file, 'r') ]
            ],
        ]);

        return json_decode($response->getBody(), true);
    }
public function create ( $ file , $ purpose , array $ headers = [ ] ) { $ response = $ this -> getClient ( ) -> request ( 'POST' , 'v1/files' , [ 'headers' => $ headers , 'multipart' => [ [ 'name' => 'purpose' , 'contents' => $ purpose ] , [ 'name' => 'file' , 'contents' => fopen ( $ file , 'r' ) ] ] , ] ) ; return json_decode ( $ response -> getBody ( ) , true ) ; }
Creates a file upload.

@param  string  $file
@param  string  $purpose
@param  array  $headers
@return array
Creates a file upload .