I am using the Jira API to add an attachment file to the case. My problem is that my code is attaching a file, and I go to the JIRA case for confirmation, I see two things. Firstly, if this is an image, I see a thumbnail of the image. However, if I click on it, I get an error: "The requested content could not be downloaded. Please try again." Secondly, under the thumbnail, instead of showing the file name, it has the path from which the file was originally downloaded (id: c: / wamp / www / .... "Is there a reason why this happens? Mine the code:
$ch = curl_init();
$header = array(
'Content-Type: multipart/form-data',
'X-Atlassian-Token: no-check'
);
$attachmentPath = $this->get_file_uploads();
$data = array('file'=>"@". $attachmentPath, 'filename'=>'DSC_0344_3.JPG');
$url= 'https://mysite.atlassian.net/rest/api/2/issue/20612/attachments/';
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_VERBOSE, 1);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0);
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 0);
curl_setopt($ch, CURLOPT_HTTPHEADER, $header);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS ,$data);
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_USERPWD, "myusername:mypassword");
$result = curl_exec($ch);
$ch_error = curl_error($ch);
Jira, jira, , : c:/wamp/www/mySite/web/system/files/my_folder/DSC_0344_3.JPG .