Recurrent issue with disappearing attachments

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • abidoss
    Senior Member
    • Mar 2023
    • 251

    #1

    Recurrent issue with disappearing attachments

    I’m experiencing a recurring issue with attachments (images, PDFs) disappearing — both from the upload directory and the database. Sometimes, only the file ID remains in the upload folder. This issue occurs unpredictably and affects several entities, even though no changes have been made to the records for months.
    As for the images, I had replaced them recently, but after about a month, they have disappeared again.
    I noticed that this problem has already been mentioned before, but it still doesn’t seem to have been resolved.

    For the images that disappeared, I only use this same form in another entity called Case.
    logoId = partenaire.logoId ;
    logo1Id = client.logoId ;



  • abidoss
    Senior Member
    • Mar 2023
    • 251

    #2
    Here’s the issue I’m facing with this entity: every month, a portal user submits their timesheet with an attachment, but each new month, I find that the attachment from the previous month has been deleted
    Attached Files

    Comment

    • emillod
      Active Community Member
      • Apr 2017
      • 1508

      #3
      Is it possible that you have some kind of automation? The attachment is still visible on Attachment list in Admin section?

      Comment

      • yuri
        EspoCRM product developer
        • Mar 2014
        • 9464

        #4
        Attachments with the following role values are removed automatically by the cleanup job.

        - Export File
        - Mail Merge
        - Mass Pdf

        If you create attachments record with such roles, you need to change the role to 'Attachment'.

        Also attachments with 'isBeingUploaded' set to true are automatically removed by the cleaup job.

        Make sure you that do NOT have the 'cleanupOrphanAttachments' parameter enabled in the config. It should not be set to true. This parameter is not enabled by default.

        Also it's possible that attachments were removed by an admin user manually from the Administration > Attachments by a mistake. It happenned.

        We have never experienced any attachment removal incidents.
        Last edited by yuri; 10-12-2025, 11:46 AM.
        If you find EspoCRM good, we would greatly appreciate if you could give the project a star on GitHub. We believe our work truly deserves more recognition. Thanks.

        Comment

        • abidoss
          Senior Member
          • Mar 2023
          • 251

          #5
          Hello,
          No, I don’t have the cleanup parameter enabled. I’m the only administrator, and no one else has permission to delete anything.
          When I check Administration > Attachments, I can’t find the attachments related to this entity, even though I can see a list of attachments in the record itself.

          To explain how it works: portal users upload their timesheet with an attachment at the end of each month in the Timesheet entity. Then, a workflow is triggered on these records to create a copy for historical tracking (see the workflow screenshot below).

          After checking, I noticed that the attachments do not appear in Administration > Attachments, but they are still visible in the records for the current month.
          Attached Files

          Comment

          • rabii
            Active Community Member
            • Jun 2016
            • 1329

            #6
            I think you are using formula to move an attachment from one record to another thinking that the attachment will be copied and duplicated. If that is what you expect the code you shared above will then you should consider another solution as using code below won't copy an attachment to another entity while reserving the original one.

            PHP Code:
            logoId partenaire.logoId;
            logo1Id client.logoId

            This code above update the attachment related to field to the entity type that logoId belongs to.
            Rabii
            say hey

            Comment


            • abidoss
              abidoss commented
              Editing a comment
              Thank you, rabii and yuri, I fully understand this point.
              The other issue concerns portal users: at the end of each month, they fill out their timesheet with an attachment in the Timesheet entity.
              A workflow is then triggered on these records to create a copy of all the data in another entity (Historiques) for archival purposes.
              So far, everything works correctly.
              However, when users fill out their timesheet for the following month, the workflow is triggered as expected, but I’ve noticed that in the previous month’s history, all the data is preserved except for the attachments, which are missing.
          Working...