Complete removal of an attachment

Enonic version: 6.14.3
OS: Linux

We have a part, which allows to upload an attachment to a page.
However, when the attachment is removed, the file itself is still available, it is still stored in a JSON of an object and it can opened via direct link and it also appears in a Google search. Is there any ways to remove the file?


1 Like

Need some more details here…

Sorry for confusion.
The part itself:

    <input type="AttachmentUploader" name="ATTACHMENT">
      <occurrences minimum="1" maximum="1"/>
    <input type="TextLine" name="ATTACHMENT_TITLE">
      <occurrences minimum="1" maximum="1"/>
    <input name="ATTACHMENT_TEXT" type="TextArea">
      <occurrences minimum="0" maximum="1"/>

When the part is added to a page in Content Studio, the file is stored on a page like this:

"attachments": {
    "filename.xls": {
      "name": "filename.xls",
      "size": 164864,
      "mimeType": "application/"

When the attachment(as a part) is removed from the page, it does not appear on a frontend of the page and the part is removed from JSON, but the file is still stored in page’s JSON same as it is in an example above.

Sorry if this is still not clear and let me know if you would like me to describe it other way.


I see, this is simply because the attachment input is just a reference to the attachment, which is stored “globally” in the content (look at the raw JSON). I guess we could have deleted the attachment if no more inputs are referencing it. But as you see, it is not done at the moment :frowning:

Thank you for a reply!
Are you planning to implement this in any future releases? Or, could you, please, give me an advice how to “cleanup” these files on a server?


Maybe the best thing would be a delete button where attachements are listed in the detail panel.

Right now you have to use api or export/import to cleanup things.

Hi. A similar problem happened to me today (enonic xp 7.10.3).
An attachment that was no longer in a content was still there (as I could see through the details tab, or in the JSON data through content viewer) despite being removed. And was accessible through it’s link and was being shown in google results.
I was able to remove the attachment from the content by reuploading the attachment in the content and deleting it again.
But the main problem is that, despite the attachment not being in the content anymore, it’s still accessible through it’s link, and I’m afraid that it may still be shown in google results because of that (despite being a deleted attachment).
I wasn’t able to find the content neither in the Content Studio, nor in the Data Tree of Data Toolbox, and searching for the content in the Data Toolbox’s Node Search also was not enough.
Is there any solution for this? I would like to have this attachment deleted but can’t find it.
Thank you.

Hi. Maybe you are using a CDN or similar, then the attachment will be cached in the network for a while, even if it is deleted in XP