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.
Table of Contents
Why Are My File Uploads Failing?
PKP applications rely on two key components to handle uploads:
- PHP File Upload Configuration – Your server must allow file uploads and provide enough resources.
- MIME Type Detection – PKP checks file types (e.g., ensuring an image is actually a
.jpgor.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 inphp.ini)upload_max_filesize(Should match your needs, e.g.,20Mfor larger PDFs)post_max_size(Must be larger thanupload_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.inior create a.user.inifile 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 restart2. 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:
- PHP’s
fileinfoExtension (Most reliable) - Legacy
mime_content_type()Function (Fallback) - System
fileCommand (Last resort)
If PKP misidentifies your file, follow these steps:
A. Ensure You’re Using Supported File Types
- Images:
.pngor.jpg(Avoid.gifunless for animations) - Documents:
.pdf,.docx(Check allowed types in your journal settings) - Favicons: Must be
.png(.icois 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/Debian:
sudo 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() failedUploaded 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/ojsFinal Checklist for Fixing Uploads
- PHP allows uploads (
file_uploads = On) - File size limits are sufficient (
upload_max_filesize,post_max_size) fileinfoextension is enabled- Correct MIME database path (or commented out in
config.inc.php) - Supported file types (e.g.,
.pnginstead 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
fileinfoand 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 ?