# How to not send attachments larger than 10 MB

**URL:** <https://community.exalate.com/t/how-to-not-send-attachments-larger-than-10-mb/4742>\
**Category:** General Questions\
**Tags:** onpremise-jira, cloud-azuredevops, migrated\_question, usecase-general, attachments-restrict\
**Created:** [November 4, 2024, 7:20am UTC](https://community.exalate.com/t/how-to-not-send-attachments-larger-than-10-mb/4742 "2024-11-04T07:20:40Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![xl8bot](https://dub1.discourse-cdn.com/flex018/user_avatar/community.exalate.com/xl8bot/32/324_2.png) [@xl8bot](https://community.exalate.com/u/xl8bot)\
**Post date:** [November 4, 2024, 7:20am UTC](https://community.exalate.com/t/how-to-not-send-attachments-larger-than-10-mb/4742/1 "2024-11-04T07:20:40Z")

</div>

_Originally asked by Francis Martens (Exalate) on 18 June 2021 [(original question)](https://oldcommunity.exalate.com/questions/30048598)_

* * *

We got this situation.  
We have a ADO to Jira integration

Jira allows the storage of only 10MB files. The setting can be adapted by the Jira team wants to limit the size to 10 MB.

Question - How can we limit the attachments to only attachments lower than 10 MB.

* * *

---

<div class="post-metadata">

**Author:** ![xl8bot](https://dub1.discourse-cdn.com/flex018/user_avatar/community.exalate.com/xl8bot/32/324_2.png) [@xl8bot](https://community.exalate.com/u/xl8bot)\
**Post date:** [November 4, 2024, 7:20am UTC](https://community.exalate.com/t/how-to-not-send-attachments-larger-than-10-mb/4742/2 "2024-11-04T07:20:41Z")

</div>

_Answer by Michiel Meurs on 21 June 2021_

Hi Francis Martens (Exalate) ,

Excellent question. This can be done fairly easily. The attachment has a property called “filesize” which is expressed in bytes. So in the script, we can add some logic that will filter out all attachments that have the filesize value that is greater than 10.000.000 bytes. (1MB = 1.000.000 bytes). Here it is:

```auto
def remoteAttachments = attachmentHelper.mergeAttachments(issue, replica)

//The max size of the attachments in bytes. 1MB = 1.000.000 bytes
def maxFileSize = 10000000
def refacturedList = []
for(file in remoteAttachments){
    if(file.filesize <= maxFileSize){
        refacturedList.add(file)
    }
}
issue.attachments = refacturedList

```

In the script, you’ll see that I created a new list, and in this list, I’ll be adding all attachments that are larger than or equal to 10MB.

Best regards,

Michiel

* * *

---

<div class="post-metadata">

**Author:** ![xl8bot](https://dub1.discourse-cdn.com/flex018/user_avatar/community.exalate.com/xl8bot/32/324_2.png) [@xl8bot](https://community.exalate.com/u/xl8bot)\
**Post date:** [November 6, 2024, 7:21am UTC](https://community.exalate.com/t/how-to-not-send-attachments-larger-than-10-mb/4742/3 "2024-11-06T07:21:29Z")

</div>

This topic was automatically closed 2 days after the last reply. New replies are no longer allowed.
