【问题标题】:Active Collab API issue with attach file or image附加文件或图像的 Active Collab API 问题
【发布时间】:2016-04-21 13:39:29
【问题描述】:

我正在为 Active Collab 中的创建任务创建 API,并且我已成功获取 getset 的新任务名称、消息和截止日期。

但是,当我插入图像或文件时,它并没有创建任务。

下面是我的代码,请帮我解决它。

try {
    API::call('projects/60/tasks/add', null, array(
        'task[name]' => $_POST['name'],
        'task[body]' => $_POST['message'],
        'task[priority]' => $priority,  
        'task[due_on]' => $date,
        'task[assignee_id]' => 21,
    ), array(
       'a.png' /* This array is for attach image to this task but not working in my case and I found this from https://help-classic.activecollab.com/books/api/sdk.html */
    ));
    echo 'Ticket Created Successfully.';

} catch(AppException $e) {
    print $e->getMessage() . '<br><br>';
    var_dump($e->getServerResponse());
}

【问题讨论】:

  • 有没有回信?? $e->getMessage()

标签: php api activecollab


【解决方案1】:

请将a.png 替换为文件系统上现有文件的绝对路径,例如/path/to/my/image.png

【讨论】:

  • @llija 我在这里提出问题之前已经应用了完整路径,但是它没有用。所以如果你有任何其他的解决方案,那么你可以帮助我。
  • 这就是文件请求的准备方式。我不确定为什么它在您的环境中不起作用。
  • @llija 你能帮我使用 Active Collab API 附加图像吗?我尝试了下面的代码,但它不起作用。 try{ API::call('projects/60/tasks/add', null, array('task[name]' => $_POST['name'], 'task[body]' => $_POST['message '], ), 数组('test.bathcomms.com/skin/frontend/bathcomms/default/images/…)); }
  • 尝试使用绝对文件路径,而不是相对路径。
  • @llija 好的,我也会尝试这种方式,但你能检查一下这个问题吗stackoverflow.com/questions/36997075/…
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 2013-07-20
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2020-05-02
  • 1970-01-01
相关资源
最近更新 更多