当我尝试将文件附加到 redmine rest api 时,我遇到了一个小问题,我正在使用 php-redmine-api-master :
if ($_FILES["file"]["error"] > 0)
{
echo "Error: " . $_FILES["file"]["error"] . "<br>";
}
else{
$attachement=file_get_contents($_FILES['file']['tmp_name']);
$upload = json_decode( $client->api('attachment')->upload($attachement) );
$client->api('issue')->create(array(
'project_id' => 12,
'subject' => 'test api3 (xml) 3',
'description' => 'test api3',
'assigned_to_id' => 23,
'uploads' => array(
array(
'token' => $upload->upload->token,
'filename' => $_FILES["file"]["name"],
'description' => 'MyFile is better then YourFile...',
'content_type'=> 'image/png'
)
)
));
print_r($client);
}
问题是附加的文件被错误地保存到redmine服务器中!