OJS 3.3.0.16 Problem with Upload Image

Hi, i’m new member btw.

I’m using OJS 3.3.0.16. I have some issue with uploading image files (Logo, Journal Thumbnail, Homepage Image, Favicon).

When i upload image there, the image is success uploaded with no error output on the page, but when i check in public directory the file size is 0 and the image extension is missing.

But, if i check on temp directory. The file that i upload before is successful uploaded with no issue.

Please help, how to fix this issue ?

Hi @f666dhn,

This appears to be the same issue encountered by another user; are you using NFS or another networked filesystem?

Regards,
Alec Smecher
Public Knowledge Project Team

Heumm, i have no idea about that. Bcs my web is hosted on shared hosting btw.

But i have another OJS website that located in the same hosting. The another OJS website is worked as well with no issue when uploading image.

Hi @f666dhn,

Very odd – that code is widely deployed and mature, and working fine just about everywhere. There is another similar report here, but otherwise I’m not aware of other cases like you describe.

The fact that you have one working install and one broken install gives us a starting point.

  • Are these both the same version of OJS? (Is there any difference between them that might be relevant?)
  • Can you check the file permissions in the containing directory, and on the created files, to see if they are the same?
  • Does the configuration file contain the same umask setting in the [files] section?
  • Can you navigate to Administration > View System Information and check the PHP version for each? (Sometimes CPanel allows different PHP versions to be executed for different parts of the hosting environment.)

Regards,
Alec Smecher
Public Knowledge Project Team

Hi @asmecher

Here is the answer of your questions:

  1. OJS with the problem on upload image is v3.3.0.16, another OJS that working fine is v3.3.0.19

  2. I’ve set permissions for ojs data directory is recursive 0777 and the public directory is recursive 0755
    image
    image

  3. The umask value is 0022

  4. The PHP version on OJS 3.3.0.16 is 8.0.30, and the PHP version on OJS 3.3.0.19 is 8.1.27

Hi @asmecher,

I have an update. When i check the table temporary_files on OJS database, the files that i uploaded before seems have incorrect MIME Types.

Here’s the screenshots:


The file_type value is application/x-empty.

But if i check the files on OJS temp directory, it have correct MIME type

Why it could happen ?

I am also exactly the same version 3.4.0.7 (php version 8.1.31), the same problem: cannot save, always endless loading.
I hope I can save files in public library.
Regards,
Waluyo

Hi all,

@waluyo, I think that might be a different problem. Check your PHP error log to see what it says.

@f666dhn, are you running a server-side virus checker? I wonder if something like that might be interfering with file storage. If you are, see if it’s possible to temporarily disable it from running on your files directory.

Regards,
Alec Smecher
Public Knowledge Project Team

@asmecher
this is the last log error when I tried to save template-numas-4.docx in the library.

Blockquote
[21-Jan-2025 07:03:02 Asia/Kuala_Lumpur] There was a problem reading the Geo database at /home/itumammy/clients/files/usageStats/IPGeoDB.mmdb. Error: The file “/home/itumammy/clients/files/usageStats/IPGeoDB.mmdb” does not exist or is not readable.
[21-Jan-2025 07:04:17 Asia/Kuala_Lumpur] PHP Warning: copy(/home/itumammy/clients/files/contexts/8/library/template-numas-4-OTH.docx): Failed to open stream: No such file or directory in /home/itumammy/clients/publish.umam.edu.my/lib/pkp/classes/file/FileManager.php on line 236
[21-Jan-2025 07:04:17 Asia/Kuala_Lumpur] PHP Notice: Only variable references should be returned by reference in /home/itumammy/clients/publish.umam.edu.my/lib/pkp/classes/file/PKPLibraryFileManager.php on line 118
[21-Jan-2025 07:04:17 Asia/Kuala_Lumpur] PHP Fatal error: Uncaught Error: Call to a member function setContextId() on bool in /home/itumammy/clients/publish.umam.edu.my/lib/pkp/controllers/grid/settings/library/form/NewLibraryFileForm.php:73
Stack trace:
#0 /home/itumammy/clients/publish.umam.edu.my/lib/pkp/controllers/grid/files/LibraryFileGridHandler.php(226): PKP\controllers\grid\settings\library\form\NewLibraryFileForm->execute()
#1 [internal function]: PKP\controllers\grid\files\LibraryFileGridHandler->saveFile()
#2 /home/itumammy/clients/publish.umam.edu.my/lib/pkp/classes/core/PKPRouter.php(334): call_user_func()
#3 /home/itumammy/clients/publish.umam.edu.my/lib/pkp/classes/core/PKPComponentRouter.php(291): PKP\core\PKPRouter->_authorizeInitializeAndCallRequest()
#4 /home/itumammy/clients/publish.umam.edu.my/lib/pkp/classes/core/Dispatcher.php(165): PKP\core\PKPComponentRouter->route()
#5 /home/itumammy/clients/publish.umam.edu.my/lib/pkp/classes/core/PKPApplication.php(395): PKP\core\Dispatcher->dispatch()
#6 /home/itumammy/clients/publish.umam.edu.my/index.php(21): PKP\core\PKPApplication->execute()
#7 {main}
thrown in /home/itumammy/clients/publish.umam.edu.my/lib/pkp/controllers/grid/settings/library/form/NewLibraryFileForm.php on line 73

Hi @asmecher and @waluyo . We are facing same problem too. We can not save anything in the library and always keep endless loading when we click Save with 0 byte size of the file on the context folder. In addition, nothing show up in the error log file . We use the OJS 3.4.0.8, PHP version 8.1, and OS is Linux. Your help will be highly appreciated
Many thanks,

I think there are many people having the same problem, cannot save in the library. I am still waiting any solution.

Regards
Waluyo

We were able to solve the problem out of OJS. Our server administrator was able to solve this problem by tracking the apache error log file and find that The mod_sec in our server was preventing files and images from uploading. We added a role to the mod_security plugin that allows files and pics and everything went fine.