src/File.php
public function save(array $data)
    {
        $project_id = empty($data['project_id']) ? 0: (int) $data['project_id'];
        if ($project_id <= 0) {
            throw new Exception('Required field project_id');
        }
        if (empty($data['pending_file_ref']) && empty($data['filename'])) {
            throw new Exception('Required field pending_file_ref or filename');
        }
        if (empty($data['pending_file_ref'])) {
            $data['pending_file_ref'] = $this->upload($data['filename']);
        }
        unset($data['filename']);
        return $this->rest->post("projects/$project_id/files", $data);
    }
public function save(array $data)
    {
        $project_id = empty($data['project_id']) ? 0: (int) $data['project_id'];
        if ($project_id <= 0) {
            throw new Exception('Required field project_id');
        }
        if (empty($data['pending_file_ref']) && empty($data['filename'])) {
            throw new Exception('Required field pending_file_ref or filename');
        }
        if (empty($data['pending_file_ref'])) {
            $data['pending_file_ref'] = $this->upload($data['filename']);
        }
        unset($data['filename']);
        return $this->rest->post("projects/$project_id/files", $data);
    }
public function save ( array $ data ) { $ project_id = empty ( $ data [ 'project_id' ] ) ? 0 : ( int ) $ data [ 'project_id' ] ; if ( $ project_id <= 0 ) { throw new Exception ( 'Required field project_id' ) ; } if ( empty ( $ data [ 'pending_file_ref' ] ) && empty ( $ data [ 'filename' ] ) ) { throw new Exception ( 'Required field pending_file_ref or filename' ) ; } if ( empty ( $ data [ 'pending_file_ref' ] ) ) { $ data [ 'pending_file_ref' ] = $ this -> upload ( $ data [ 'filename' ] ) ; } unset ( $ data [ 'filename' ] ) ; return $ this -> rest -> post ( "projects/$project_id/files" , $ data ) ; }
Add a File to a Project

POST /projects/#{file_id}/files

@param array $data

@return int File id
@throws \TeamWorkPm\Exception
Add a File to a Project