How to upload attachments from the CSV file?

Vladimir Belorusets December 14, 2011

I have the following CSV file:

ID,"Type","Summary","State","Assigned User","Attachments"
125653,"Defect","Manager: GUI - Unable to start multiple stopped instances ","Accepted","Armen","190112.jpg"

It fails to upload the attachment. What is the workaround? What directory should the attached file be?

1 answer

1 vote
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.
December 14, 2011

JIRA CSV Importer supports only file import via URLs. So in your CSV file you have to include full URL to each of the file you want to import. Then you have to expose your files via HTTP or HTTPS. You can easily try this out using dropbox.com - where files can be accessible via http. In normal production environment we would expect customers to expose these files via HTTP (or HTTPS) on some internal web server.

For Windows users (tried out on Win 7 Professional) you can quite easily do that without too much hassle:

  • make sure that IIS is installed
  • put all the files you want to import into some directory
  • in IIS add this directory to a new or existing web site
  • make sure your web site is started
  • you can click on a file from a IIS management console and "browse it" - it should open a web browser pointing to this file. If your web browser successfully downloads the file - you are ready to proceed with the import to JIRA - just use the same URLs in your CSV file

This article should help you http://support.microsoft.com/kb/323470 - just do not bother about security part - the best for this exercise is to allow anonymous access

file:// protocol is not supported due to security reasons - it would be possible to access any file from the server which JIRA instance is hosted. JIRA does protect local file system from being accessed. Even JIRA system admins can access normally only $JIRA_HOME directory and its subdirectories.

I've just realized that the documentation for this part of CSV importer needs improvement. That will be fixed.

Vladimir Belorusets December 15, 2011

Thank you, Wojciech. When I included the attachment url, JIRA added viewattachment under the Attachments and under Activity/Comments inserted the url for attachment but not file itself. Is it possible to insert the file? Then we do not need to keep the old defect tracking system just to access the attachment.

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.
December 15, 2011

That's strange. The importer should copy the content of the files from given URLs. If it does not - that's looks like a wrong configuration or a bug in it. Could you raise a bug on https://studio.atlassian.com/browse/JIM and give there more details (including your cfg file, a screenshot of your field mapping screen, the etc.)?

Vladimir Belorusets December 16, 2011

I see the problem is in how we access the attachment. The url is

http://bel1app014:7001/im/viewattachment?issue=121549&attachment=bug121549.txt

where viewattachment is the script with 2 parameters added. JIRA considers the part before ? as the url to attachment and it strips the rest. Is there any workaround?

Thanks

Suggest an answer

Log in or Sign up to answer