How to import attachment files?

Samir Freelance
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
June 29, 2011

I have to import manually or by hand attachements files related to an issue

should i copy the files to i copy my old files to the folder C:\Program Files\Atlassian\Application Data\JIRA\data\attachments\ ??

and i also want to import or add exising issues created by another software

i am generating database backup of the old software

I just need to add the old issue created by a specific user and related attachement

please help

4 answers

0 votes
Wojciech Seliga
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
July 5, 2011

JIM (JIRA Importers Plugin - bundled with newest JIRA) supports importing attachments (at least a few recent versions) - but only together with issues. I.e. you cannot import attachments to an existing JIRA issue, but you can to a new one (created by JIM during the import).

0 votes
Luis Mayora
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
June 29, 2011

I have used the SOAP API. Check the following code.

//Call

oSoapJiraClient.ImportAttachment(token, issueKey, filePath, new string[] { fileName });

//Soap Client

public bool ImportAttachment(string token, string issueKey,string filepath, string[] filenames)
{
bool result = false;
try
{
string[] attachmentData = new string[]{ FileToBase64String(filepath)};
result = jiraSoapService.addBase64EncodedAttachmentsToIssue(token, issueKey, filenames, attachmentData);
}
catch (Exception e)
{
throw e;
}


return result;
}

public string FileToBase64String(String FilePath)
{
string buffer = null;

try
{
byte[] fileBytes= File.ReadAllBytes(FilePath);
buffer = Convert.ToBase64String(fileBytes);
}
catch (IOException e)
{
throw e;
}
return buffer;
}

Samir Freelance
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
June 30, 2011

Louis how can i use your script ,

where to copy it? and how to run it?

0 votes
Bob Swift (personal)
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
June 29, 2011
0 votes
Nic Brough -Adaptavist-
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
June 29, 2011

That won't work. You need code, or to directly hack the database (Which is hugely risky and can destroy all your data), because Jira tracks the attachments internally.

Personally, I'd choose to either use some SOAP in a script/program on my local machine, or, if you can drop the attachments on to the Jira server, I'd probably reach for a jelly script to get them into Jira from a temporary location http://confluence.atlassian.com/display/JIRA/Jelly+Tags#JellyTags-jira%3AAttachFile</p<>>

> and i also want to import or add exising issues created by another software

There are import options - start at http://confluence.atlassian.com/display/JIRA/Migrating+from+Other+Issue+Trackers</p<>>

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events