public function uploadMedia($filepaths, $client = null)
    {

        //maximum number of media files that a user can upload
        $maxMediaIds = Config::get('max_media_ids');

        //if number of media files supplied is larger than $maxMediaIds, throw exception.
        if(count($filepaths) > $maxMediaIds)
        {
            throw new MediaUploadLimitException("You cannot upload more than ${maxMediaIds} media files in a tweet!");
        }

        //array list of media id's uploaded
        $mediaIds = array();

        //create a new Guzzle client, if the user hasn't injected anything!
        if(is_null($client))
        {
            $client = $this->createGuzzleClient(Config::get('base_upload_url'));
        }

        //prepend Twitter's API version to the endpoint
        $endpoint = $this->prependVersionToEndpoint("media/upload.json", Config::get('api_version'));

        //iterate over each filepath
        foreach ($filepaths as $filepath)
        {

            //contruct an options array to configure the request
            $options = $this->constructRequestOptions(array(), $client);

            //add body options to the POST request
            $options['body'] = array (
                'media' => new PostFile('media', fopen($filepath, 'r'))
            );

            //make the POST request to the endpoint with the constructed options.
            $response = $client->post($endpoint, $options);

            //add media_id to array
            array_push($mediaIds, $response->json()['media_id_string']);

        }

        //return all media ID's as a string (comma seperated)
        return (implode(",", $mediaIds));

    }