Hi,
I started having this problem on an older installation of 1.15.x (1.15.3) and tried to understand the root cause then I upgraded to the latest stable 1.15.7 but still no joy.

The save to filesystem plugin is enabled (has also been updated to the latest) and selected in settings.

It seems it save the file in the database but ONLY SOME files end up on the filesystem. I am trying to understand what is the pattern.
I set the permissions on that directory to 0751.
I tried to upload from Firefox and Chrome no difference.
The filename is displayed as attached but when you want to download it it comes up with a blank page. Before it was downloading a file with 0 kB size.

Please note that both upload_max_filesize and post_max_size are set high to 512M on the server. The files I tried to upload are under 300MB.

Even changing to database from filesystem as storage does not make any difference which indicates a more profound issue. Not sure if some caching can impact this.

I also get these errors via email:

(root)/storage/Y/Yg4kaXt_0_Kzn8G8DmMpSIvZ-fSbi558: Unable to read from file
#0 (root)/include/class.file.php(123): FilesystemStorage->passthru()
#1 (root)/include/class.file.php(283): AttachmentFile->sendData(false)
#2 (root)/file.php(68): AttachmentFile->download(NULL, 'attachment', '1650672000')
#3 {main}

Please advise.
Best regards

    What's the permissions / ownership on your PHP temp upload folder?
    This folder/directory is used by PHP to store the file while it uploads, and is then moved to the location where it belongs in the filesystem.

    VerusAutenticus Unable to read from file

    This sounds like a permissions issue. or a 0 size file.

    I have checked and the temp directory is simply /tmp
    The original permissions were 700.
    I have changed them to 777 which is not secure but I reckon good for testing.
    I select a file and the uploading bar progresses
    when it reaches the end then I see a temporary file is created in /tmp
    then that temp file grows in size then the upload is finished and I press Save.
    The temporary file is gone from /tmp, I see file listed in the attachments BUT some files are transferred to permanent location and some are not.
    It looks like I can attach some files but not all and the size of them does not matter.
    It looks like the files I started having issue uploading initially I cannot upload even after 40 tries but new files go through fine. For some reason the files I am trying to upload are remembered and I cannot succeed. I don't have any file type extension restrictions.

      VerusAutenticus

      Have you tried setting your attachment directory permissions to 0777 to test. Also, are you running something like SELINUX?

      It basically sounds like it has trouble writing from tmp to your attachment directory.

      Cheers.

      Hi, yes I changed the permissions to 0777 and done some more testing.
      I also tested it from another machine in case there is some proxy, caching glitch.
      Still the same, I can upload a number of files but I cannot certain binaries (.deb, .rpm).
      But I think I did upload other debs and rpms in the past.
      This must be some more recent change on the hosting side of things that prevents these 2 files to be moved from tmp to permanent storage.

        VerusAutenticus

        Maybe try adding those file types to the Additional File Type Filters setting in Admin Panel > Settings > Tickets > Ticket Attachment Settings > Config?

        Cheers.

        I did apply this and it does not work. I uploaded a large .run file and it works but then I tried to upload a small .RUN file but then it fails to download so I assume it never made its way to permanent location and I get an email notification every time.

        (root)/st0rag3/M/MhEFeiqA1LeoNvprVXbX5_nTw09LS3t8: Unable to read from file
        
        #0 (root)/include/class.file.php(123): FilesystemStorage->passthru()
        #1 (root)/include/class.file.php(283): AttachmentFile->sendData(false)
        #2 (root)/file.php(68): AttachmentFile->download(NULL, 'attachment', '1650931200')
        #3 {main}

        BUT there is a difference

        1. large .RUN can be downloaded, it thinks for a bit then the file comes up for saving onto disk
        2. small .RUN cannot be downloaded, ends up "This site can’t be reached" in Chrome and an email notification each time I try to download it (example above)
        3. large .DEB comes up immediately for saving but the file is 0 kB, no email notification

        I have the output of php -i if it can shed any light but not sure what extension to use as it does not accept .txt as attachment in here

        @VerusAutenticus

        I am at a loss. I cannot replicate the issue. Please make sure all of your PHP/Apache configs for max upload size, etc. are all updated.

        If all else fails you will need to continue debugging.

        Cheers.

        I think the ones that apply are set correctly.

        upload_max_filesize => 512M
        post_max_size => 512M

        Ok, I see what I can do about it and/or contact the hosting provider.

        Do you think SELINUX could cause this type of issue?
        I use this upload facility for a number of years, initially writing to the database then changed to filesystem. It could be something has changed on the server config because the issue is intermittent, not obvious.
        But changing back to database does not help so it must be something outside filesystem upload.

          VerusAutenticus

          With SELINUX anything is possible lol I’ve seen the strangest issues with SELINUX so I wouldn’t put it past it lol

          But it is strange that the same file type works for some and not for others. Since you are using a hosting provider I would check with them to see if any security rules are blocking it. I’ve seen in the past where the host has weird/strict security rules that disallow certain actions in the helpdesk.

          Cheers.

            KevinTheJedi ince you are using a hosting provider I would check with them to see if any security rules are blocking it.

            I've seen this too.

            8 days later

            Just FYI it looks like the security settings on the provider's side don't allow for such binary attachments to be uploaded but they do upload fine when Zipped. So there is a workaround.

            Write a Reply...