Querying attachments per file type

Platform Notice: Data Center Only - This article only applies to Atlassian products on the Data Center platform.

Note that this KB was created for the Data Center version of the product. Data Center KBs for non-Data-Center-specific features may also work for Server versions of the product, however they have not been tested. Support for Server* products ended on February 15th 2024. If you are running a Server product, you can visit the Atlassian Server end of support announcement to review your migration options.

*Except Fisheye and Crucible

Summary

The content on this page relates to platforms which are not supported. Consequently, Atlassian Support cannot guarantee providing any support for it. Please be aware that this material is provided for your information only and using it is done so at your own risk.

To retrieve the list of Jira attachments based on their file type. The results contain the attachment ID, file name, project key, and issue number.

Solution

To retrieve a list where the file type is based on filename extensions run the following query, replacing .png with the file extension you want:

1 2 3 4 5 SELECT fa.id, fa.filename, p.pkey, ji.issuenum FROM fileattachment fa JOIN jiraissue ji ON ji.id = fa.issueid JOIN project p ON p.id = ji.project WHERE LOWER(fa.filename) LIKE '%.png';

To retrieve a list where the file type is based on MIME type run the following query, replacing image/png with the MIME type you want:

1 2 3 4 5 SELECT fa.id, fa.filename, p.pkey, ji.issuenum FROM fileattachment fa JOIN jiraissue ji ON ji.id = fa.issueid JOIN project p ON p.id = ji.project WHERE LOWER(fa.mimetype) = 'image/png';
Updated on April 8, 2025

Still need help?

The Atlassian Community is here for you.