Where can I store images (uploaded via plugin) and make them available with a URL in a plugin?

I wrote a plugin. It has function for upload image and show image it via URL.

I uploaded the image and store it in the (tomcat of jira : …/…/container/tomcat8x/cargo-jira-home/webapps/jira/images) then the image can be access via URL …/jira/secure/imageName.jpg

But I wonder if the image stored in tomcat is properly right way?

I find so way to store an image in the {JIRA_HOME}/data/… But I don’t no the way to access the image via URL.

Does anybody know how to access the image in {JIRA_HOME} via URL?

hi @tien.dang,

this community answer might be what you’re after: https://community.atlassian.com/t5/Answers-Developer-Questions/Jira-Plugin-storing-files/qaq-p/554305

You’ll need to create your own servlet that can serve up the file from the home directory take a look at https://developer.atlassian.com/server/jira/platform/servlet/

1 Like

@daz Thank you. I know the way to store image in Jira Home. But i don’t know the way to show the image via URL. That’s my problem.
I can access the image via URL if the image store in tomcat (…/…/container/tomcat8x/cargo-jira-home/webapps/jira/images).
Could you tell me what is the right way for store image?

Thank you @danielwester
Could I build the new URL for the image store in {JIRA_HOME} without creating my own servlet?

I resolve this problem by use the rest api.
I save the image in JIRA_HOME. And read image, send it via rest(url)