【问题标题】:Redmine, upload file with cURLRedmine,使用 cURL 上传文件
【发布时间】:2013-09-11 23:01:43
【问题描述】:

我正在尝试使用 cURL 从 shell 脚本将文件上传到 Redmine:

url=localhost/redmine
curl -c cookie -F username=admin -F password=admin $url/login
curl -b cookie -F 'attachments[1][file]'=@file $url/projects/test/files/new

第一个curl在成功登录后将会话cookie存储到文件cookie中。但是第二个上传的curl 总是失败。 Redmine的神秘错误信息是

ActionController::MethodNotAllowed
Only get requests are allowed.

有什么想法吗?

【问题讨论】:

标签: cookies curl redmine


【解决方案1】:

这似乎可以解决问题:

curl -c cookie -F username=admin -F password=admin $url/login
curl -b cookie -F attachments[0][file]=@file $url/projects/test/files/new

似乎 Ruby 属于从零开始索引数组的稀有语言家族,因为attachments[0][file] 可以,而attachments[1][file] 则不行。

【讨论】:

    猜你喜欢
    • 2015-05-14
    • 2013-03-15
    • 1970-01-01
    • 2017-11-12
    • 2011-10-23
    • 2015-11-04
    • 1970-01-01
    • 2023-03-29
    • 2015-11-11
    相关资源
    最近更新 更多