[OJS 2.x] Unable to upload files as attachment

Hello all,

I’m not sure if anyone has come across this problem.
This is just to report the following situation and solution.

We frequently run into problems uploading files as attachments in reviewer e-mails. The e-mail template is displayed instead, and no specific may be found.

We believe this error message may be key to pinpoint the issue:
[Tue May 22 13:08:33 2018] [error] [client] ojs2 has produced an error\n Message: WARNING: fopen(): Filename cannot be empty\n In file: /var/www/devojs.ibict.br/lib/pkp/classes/file/FileWrapper.inc.php\n At line: 71\n Stacktrace: \n Server info:\n OS: Linux\n PHP Version: 5.4.45-0+deb7u2\n Apache Version: Apache/2.2.22 (Debian)\n DB Driver: mysql\n DB server version: 5.5.46-0+deb7u1

This, in our observation, occurs because of file properties, and not an OJS problem itself. Our files are stored in a remote file server in our network. Sometimes, when we lose network connection, file properties are changed, we have no idea why. Sometimes they are set to read-only, sometimes as “archived”. This prevents OJS from attaching the files.