phpcodeigniterseafile-server

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: https://manual.seafile.com/develop/web_api.html#upload-file-1

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?


Solution

  • Well, a lot of thing could be happening... did you tried to put new Curlfile('test.txt') into a separated variable and then var_dump/die() it to see if the file is really being "loaded" correctly? Also, are you passing the absolute path to that file?