"Files of this type can not be uploaded" error

Hello everybody,
I am trying to upload new plugins in my OJS administration through Site settings > Plugins > Upload A New Plugin, but it always ends up with the error message “Files of this type can not be uploaded”.

err

I am uploading the plugins in a tar.gz archive.

I checked my server settings to see if these files are disabled at the Apache or PHP level, but this was not the case (our hosting technical support also confirmed that uploading files of this type is allowed on the server). Do I need to change something in the OJS settings? Am I missing something? Is there anything I should check?

I’m using OJS 3.3.0.8.

Thank you all in advance for your help.

Hi @jiri, is it possible there is an issue with the plugin packages themselves? How are you creating them or downloading them?

Hi @kaitlin, thanks for your reply. However, I’m not sure if the problem is in the plugin packages themselves. I download them from the official website—e.g., Releases · pkp/orcidProfile · GitHub. There, I select the version corresponding to my OJS and download it in tar.gz format (on the mentioned page, for example, it is orcidProfile-v1_1_3_14.tar.gz). I also get the same error (“Files of this type cannot be uploaded”) when I install plugins via the plugin gallery.

Hi @jiri, it sounds like the issue isn’t the file packages. Is anything appearing in your PHP error log at the point when you try to install a plugin? And what do you have set in your config.inc.php file for tar (under the [cli] section)?

Hi @kaitlin, no, there are no errors in my PHP log (or Apache log) at that time. In my config.inc.php, I can see tar as follows:

tar = /bin/tar

Does that help?

Hi @jiri

The Most Likely Cause: PHP [fileinfo] Extension
OJS 3.3 relies on a PHP extension called fileinfo to determine the real MIME type of a file (e.g., to confirm a .tar.gz file is actually application/x-gzip).

If the fileinfo extension is disabled on your server, OJS cannot verify any uploaded file. It rejects the file because it cannot confirm it’s safe. This also explains why the Plugin Gallery fails: OJS downloads the .tar.gz file from the PKP server, tries to validate it using fileinfo, fails, and gives you the exact same error.

Manual Installation - New Installation Plugin

If you still can’t get the uploader to work, you can always install the plugin manually. This method bypasses the upload check entirely.

  1. On your local computer, unzip the .tar.gz file. You should get a folder (e.g., quickSubmit, googleAnalytics, etc.).

  2. Using an FTP/SFTP client (like FileZilla) or your hosting cPanel File Manager, connect to your server.

  3. Navigate to your OJS plugins/ directory.

  4. Inside the plugins/ directory, find the correct sub-directory for your plugin type. (e.g., generic/, themes/, importexport/). The plugin’s documentation will tell you which one.

  5. Upload the entire plugin folder (from Step 1) into that directory.

    • Example: Upload the orcidProfile folder to plugins/generic/ so the final path is plugins/generic/orcidProfile/.
  6. Go back to your OJS admin dashboard: Site settings > Plugins.

  7. Find the new plugin in the list. It will be disabled.

  8. Click the Enable checkbox next to it.

Manual Installation - Upgrade Plugins

*Warning: Always backup your database and files, before this progress

  1. After Replace Plugin Files
  2. Run Database Upgrade: You must update the database to match the new code.
    • Recommended Method (SSH): Access your server via command line and run:

      Bash

      php tools/upgrade.php upgrade
      

      This is a safe command. It checks all plugin versions and runs the necessary database scripts for the plugin you just updated.

    • Alternative Method: Set installed = Off in config.inc.php and execute run upgrade. back to installed = On if finished.

For the second time I remind you to always backup the database and files before this process is carried out.

As a further consideration, always update your OJS to the latest version (from 3.3.0.8 to 3.3.0.21), See: MEMO: Keeping your OJS Installation Secure with Upgrades and more

Hi @ashvisualtheme, thanks a lot for the detailed explanation!

I checked phpinfo() and the fileinfo extension is enabled on my server (fileinfo support => enabled), so this doesn’t seem to be the cause in my case.

Do you perhaps have any suggestions for the next things to check?

Hi @jiri

Thanks for that confirmation. Okay, so we can rule out the fileinfo extension as the cause.

You mentioned in your earlier reply (to @kaitlin) that you also get the same error when installing from the Plugin Gallery. This is a very important clue.

A failure in both places (manual upload and the Plugin Gallery) strongly suggests that OJS is failing at the step after getting the file: the unpacking process.

As you suspected, the most likely cause for this is the exec function being disabled in your PHP configuration.

Here is the process:

  1. OJS needs to execute the server command for tar (which is defined in your config.inc.php as /bin/tar) to unpack the .tar.gz archive.

  2. To run this external command, PHP needs to use a function like exec.

  3. If exec is listed in your server’s disable_functions (which is very common on shared hosting for security reasons), OJS has no permission to run the tar command.

  4. The process fails, and it falls back to the generic “Files of this type can not be uploaded” error because it couldn’t successfully unpack and validate the contents.

Action:

Please check your phpinfo() : (https)yourOJS.com/index.php/index/admin/phpinfo output again. Search for the disable_functions directive.

disable_functions

Check if exec is in that list. If it is, you will need to remove exec from the disable_functions.

If exec turns out not to be the problem, the next most common things are Folder Permissions (make sure the plugins/ directory is writable) and open_basedir restrictions in PHP (which can block execution of /bin/tar).

regard,
AshVisualTheme

Hi @ashvisualtheme,

Thank you very much for your reply and detailed explanation. I checked the disable_functions item in the phpinfo() output, but I don’t see the exec function there. I only see pcntl_exec there, which I assume is not relevant.

As for the plugins/ folder, I see its permissions set to 775—is that okay? Could you please provide more detailed information on what the open_basedir setting should look like?

Thanks a lot in advance!