Seafile php file upload

I have created a basic CRM system using CodeIgniter in PHP and are making use of Seafile-Serve Web API to store and retreive files locate on the same server that hosts the CRM. The following is a function I created to upload existing files to seafile using the post method defined in the api manual.

    public function uploadFile($upload_link, $upload_file, $upload_filename){
    return $this->decode($this->post($upload_link,
        array(
            'file'  => new Curlfile('test.txt'),
            'filename'  => "test.txt",
            'parent_dir' => "/"
        )
    ));
}

Can I perhaps ask that someone point out the various things I am doing wrong?