How to fix Upload Errors in PKP Software (OJS/OMP/OPS)

File upload issues are a common frustration for PKP (Public Knowledge Project) software users, whether you’re running OJS (Open Journal Systems), OMP (Open Monograph Press), or OPS (Open Preprint Systems). If your system is rejecting uploaded files—or failing to recognize valid file types—this comprehensive guide will help you diagnose and resolve the problem. You also may get something like this error : “No file uploaded or invalid file type!”.

The cause of this issue may be caused by mimetype setting.

Why Are My File Uploads Failing?

PKP applications rely on two key components to handle uploads:

  1. PHP File Upload Configuration – Your server must allow file uploads and provide enough resources.
  2. MIME Type Detection – PKP checks file types (e.g., ensuring an image is actually a .jpg or .png) before accepting them.

You may also get error like this :

[10-May-2025 10:00:00 UTC] PHP Strict Standards: Declaration of SettingsFileUploadForm::fetch() should be compatible with Form::fetch($request, $template = NULL, $display = false) in /var/www/html/ojs/lib/pkp/controllers/tab/settings/form/SettingsFileUploadForm.inc.php on line 18
[10-May-2025 10:00:00 UTC] PHP Strict Standards: Declaration of NewContextImageFileForm::fetch() should be compatible with SettingsFileUploadForm::fetch($request, $params = NULL) in /var/www/html/ojs/lib/pkp/controllers/tab/settings/appearance/form/NewContextImageFileForm.inc.php on line 18
[10-May-2025 10:00:00 UTC] PHP Strict Standards: Declaration of NewContextImageFileForm::initData() should be compatible with Form::initData() in /var/www/html/ojs/lib/pkp/controllers/tab/settings/appearance/form/NewContextImageFileForm.inc.php on line 18
[10-May-2025 10:00:00 UTC] PHP Strict Standards: Declaration of NewContextImageFileForm::execute() should be compatible with Form::execute() in /var/www/html/ojs/lib/pkp/controllers/tab/settings/appearance/form/NewContextImageFileForm.inc.php on line 18
[10-May-2025 10:00:00 UTC] PHP Strict Standards: Non-static method PKPRequest::getUserVar() should not be called statically, assuming $this from incompatible context in /var/www/html/ojs/lib/pkp/classes/form/Form.inc.php on line 388
[10-May-2025 10:00:00 UTC] PHP Strict Standards: Non-static method PKPRequest::_checkThis() should not be called statically, assuming $this from incompatible context in /var/www/html/ojs/lib/pkp/classes/core/PKPRequest.inc.php on line 592
[10-May-2025 10:00:00 UTC] PHP Strict Standards: Non-static method PKPRequest::getUserVar() should not be called statically, assuming $this from incompatible context in /var/www/html/ojs/lib/pkp/classes/form/Form.inc.php on line 388
[10-May-2025 10:00:00 UTC] PHP Strict Standards: Non-static method PKPRequest::_checkThis() should not be called statically, assuming $this from incompatible context in /var/www/html/ojs/lib/pkp/classes/core/PKPRequest.inc.php on line 592
[10-May-2025 10:00:00 UTC] PHP Strict Standards: Only variables should be assigned by reference in /var/www/html/ojs/lib/pkp/classes/file/TemporaryFileDAO.inc.php on line 37

If either of these fails, you’ll encounter errors. Below, we break down the most common causes and their fixes.

1. PHP Upload Configuration Issues

Before PKP can process a file, your PHP settings must permit uploads. Here’s how to check:

Key PHP Settings to Verify

  • file_uploads = On (Must be enabled in php.ini)
  • upload_max_filesize (Should match your needs, e.g., 20M for larger PDFs)
  • post_max_size (Must be larger than upload_max_filesize)
  • memory_limit (Should be sufficient for processing)

How to Check & Modify PHP Settings

  • Shared Hosting: Use a tool like cPanel → PHP Selector or contact your hosting provider.
  • VPS/Dedicated Server: Edit php.ini or create a .user.ini file in your web root.
  • Quick Test: Run a phpinfo() script to confirm current settings.

Tip: After changing PHP settings, restart your web server (Apache/Nginx) for changes to take effect.

To restart your apache :

service apache2 restart 

To restart nginx :

service nginx restart

2. MIME Type Validation Failures

PKP software checks file types to prevent malicious uploads (e.g., disguising an .exe as an image). It uses three methods in order:

  1. PHP’s fileinfo Extension (Most reliable)
  2. Legacy mime_content_type() Function (Fallback)
  3. System file Command (Last resort)

If PKP misidentifies your file, follow these steps:

A. Ensure You’re Using Supported File Types

  • Images.png or .jpg (Avoid .gif unless for animations)
  • Documents.pdf.docx (Check allowed types in your journal settings)
  • Favicons: Must be .png (.ico is not recommended)

B. Verify config.inc.php Settings

Open your PKP installation’s config.inc.php and check:

; Correct path to MIME database (Unix/Linux)
mime_database_path = /usr/share/misc/magic.mime

; If unsure, comment it out to use PKP’s internal database<br>; mime_database_path =

C. Debug Missing PHP Extensions

Run:

<?php phpinfo(); ?>

And search for:

  • fileinfo (Should be enabled)
  • mime_content_type (Deprecated but may be used as fallback)

If fileinfo is missing, enable it via:

  • Ubuntu/Debiansudo apt-get install php-fileinfo
  • cPanel: Use PHP Selector → Enable fileinfo

Advanced Troubleshooting

If uploads still fail:

1. Check Server Error Logs

  • Apache/var/log/apache2/error.log
  • Nginx/var/log/nginx/error.log
  • Shared Hosting: Check cPanel → Error Logs

Look for errors like:

  • PHP Warning: finfo_open() failed
  • Uploaded file exceeds allowed size

2. Test with a Simple Upload Script

Create a test_upload.php file:

<?php
if ($_FILES["file"]["error"] > 0) {
    echo "Error: " . $_FILES["file"]["error"];
} else {
    echo "Upload successful!";
}
?>

If this fails, the issue is server-side (not PKP-specific).

3. Verify File Permissions

PKP’s files and public  directoris must be writable:

chmod 775 /path/to/ojs/public/uploads
chown -R www-data:www-data /path/to/ojs

Final Checklist for Fixing Uploads

  • PHP allows uploads (file_uploads = On)
  • File size limits are sufficient (upload_max_filesizepost_max_size)
  • fileinfo extension is enabled
  • Correct MIME database path (or commented out in config.inc.php)
  • Supported file types (e.g., .png instead of .gif)
  • Directory permissions allow uploads (chmod 775)

Need More Help?

If you’ve tried all steps and still face issues:

  • Contact your hosting provider (Ask about PHP fileinfo and upload limits).
  • Contact us for more intermediate solutions.

By following this guide, you should resolve most PKP file upload errors.

File upload also may become a door for hacker to hack your OJS. It needs to be protected for more advance guide for protecting your OJS, check our article : How to secure your OJS site ?

Tags :
About the Author
user-avatar

Project Manager

Hendra here, I love writing about OJS and share knowledge about OJS. My passion is about OJS, OMP platform and doing some research on creating innovated products for that platform to help publisher to improve their publication.

Leave a Comment

Your email address will not be published. Required fields are marked *

Open Journal Theme

Need More Services  or Question?

Openjournaltheme.com started in 2016 by a passionate team that focused to provide affordable OJS, OMP,  OPS,  Dspace, Eprints products and services. Our mission to help publishers to be more focus on their content research rather than tackled by many technical OJS issues.

Under the legal company name :
Inovasi Informatik Sinergi Inc.

Secure Payment :

All the client’s financial account data is stored in the respective third-party site (such as Paypal, Wise and Direct Payment).
*Payment on Credit card can be done by request
Your financial account is guaranteed protection. We never keep any of the clients’ financial data.

Index