Issue cover fails to upload on OJS3

On OJS3, we cannot upload the cover image for a new issue. Here’s our journal manager:

“I seem to have run into an issue where the cover image for an issue fails to upload properly. Here are a few screenshots of what happened. In short, I was able to drag and drop the .png file of the cover, and it seems to upload, but then when I click “Save” I get an error message saying that only .png .jpg or .gif files are supported (which does not make sense since I uploaded a .png file). I have tried this repeatedly with a .png and also a .jpg and get the same error message each time. Do you have an idea of what might be causing this issue?”

2 Likes

Have you checked that there is a .png extension at the end? Did you also click “upload file” before saving?

Cheers!

Hi @wilsonw,

Most likely OJS is having trouble getting the MIME type of the uploaded PNG file, which it uses to ensure that the file is actually the type that’s required. Search this forum for MIME and you’ll find related threads with suggested solutions.

Regards,
Alec Smecher
Public Knowledge Project Team

1 Like

Thanks @asmecher

Error message on upload: "No file uploaded or invalid file type!" worked after commenting out mime_database_path in config.inc.php

It doesnt work for me, I have this:

[finfo]
; mime_database_path = /etc/magic.mime
1 Like

Hi @josuevalrob,

Which of our applications are you using, and what version? (Please include this information in your posts.) Is your problem occurring when you try to upload an issue cover, or something else?

Regards,
Alec Smecher
Public Knowledge Project Team

OJS version 3.
I have an Apache on an IIS server.
PHP version 5.6
PHP error log doesn’t show me anything.

Yes, it just happened when I try to upload the cover image of an issue.

Thanks for your time!

Hi @josuevalrob,

Have you worked through this FAQ entry?

Regards,
Alec Smecher
Public Knowledge Project Team

@asmecher My journal has been peaceful but not anymore after upgrading from 3.0.2 to OJS 3.1.0 build 1. Images cannot upload…

My mimetype settings is:

;mime_database_path = /etc/mime.types
mime_database_path = /etc/magic.mime

The one that is commented was working b4 upgrade… now none of them works.

My hosting says:

Dear Client,

Please try now. We have set your php version to native which should work. mimetypes are on /etc/mime.types

Karani.

Sasahost Limited

1 Like

Hi @otuya1,

Are you sure the issue is the MIME type configuration? That hasn’t changed between OJS 3.0.2 and 3.1.0-1. It’s much more likely that the problem is something else, like file permissions in your files_dir if they somehow got changed during the upgrade.

Regards,
Alec Smecher
Public Knowledge Project Team

I have facing the same problem as well. I try to commenting mime_database_path = /etc/magic.mime in config.inc.php but doesn’t work. I try go to Cpanel on my server journal and select PHP extensions fileinfo which my default PHP extensions the extension is not selected. After I select fileinfo extension the problem solved, I successes upload cover image. Might someone there try this.

Regards.

1 Like

When I updated to 3.1.1 this also broke for me. However, I had also updated my PHP version. My ISP installed MultiPHP Manager, which allows you to run a distinct version of PHP by domain. I set OJS to use PHP version 5.6x (ea-php56). I also disabled PHP-FPM for my OJS domain (the latter is supposed to improve performance). After all of that, I set the following in config.inc:

mime_database_path = /etc/mime.types

“Magically” it started to work again. The joke here is that the default value of /etc/magic.mime had to be changed to get it to work properly. Note that your site will not function for a minute after you change the PHP version. If you don’t have MultiPHP Manager installed yet, I highly recommend it.

I also solved it by

  1. changing PHP to 7.3,

2)selecting fileinfo extension

  1. Changing config.inc.php to mime_database_path = /etc/mime.types

Thanks all

Seriously consider upgrading your PHP!

Iam using OMP 3.1.2.4
Nginx Server
PHP 7.4.x
fileinfo extensions enabled
uncomment mime_database_path = etc/mime.types in config.inc.php
.
.
cover files fails to save … and upload
How to fix it

I have the same problem. I try to activate “fileinfo” in php extension, and i fix the problem.
Based on this article : https://ilmubersama.com/2019/07/11/ojs-3-no-file-uploaded-or-invalid-file-type/

1 Like

Here, original config was
mime_database_path = /etc/magic.types

I changed to:
mime_database_path = /etc/mime.types

Worked for me

Tks!

A post was split to a new topic: Issue with image upload

Thanks a lot. My problem was solved.
config.inc
;[finfo]
;mime_database_path = /etc/magic.mime
Portugês:
erro ao fazer upload de capa para o ojs.
Comente as linhas acima.

This topic was automatically closed after 4 days. New replies are no longer allowed.