Project

General

Profile

REST API Attaching files is wrong

Added by Sergey S almost 11 years ago

I have problem with attach files using REST API.
File successfully uploading, but size it's more than size source.
For upload I use CURL on PHP:
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, $params);
curl_setopt($ch, CURLOPT_HTTPHEADER, array('Content-Type: application/octet-stream'));
$res = curl_exec($ch);
curl_close($ch);

Result of this code execute in $res - I get xml answer with token.
After it I create new Issue with this attach. All ok, Issue created, Attachment exists, but on begin of attached file added this strings:
------------------------------e7d343ee91fb
Content-Disposition: form-data; name="file"; filename="var/files/uploads/2013/12/10/10/c1a91f11fd/1431"
Content-Type: application/octet-stream

and to bottom of file:
------------------------------e7d343ee91fb--

Please, say me, what I make not correctly?
Thanks.


Replies (1)

RE: REST API Attaching files is wrong - Added by Jonathan Quiacain almost 4 years ago

I have the same problem, can someone help us?

Thanks

    (1-1/1)