Issue cover fails to upload on OJS3

ojs3
upload
Tags: #<Tag:0x00007f126e0914b0> #<Tag:0x00007f126e091370>

#1

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

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

Cheers!


#3

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


#4

Thanks @asmecher

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


#5

It doesnt work for me, I have this:

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

No file uploaded or invalid file type in some part and other work
#6

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


#7

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!


#8

Hi @josuevalrob,

Have you worked through this FAQ entry?

Regards,
Alec Smecher
Public Knowledge Project Team


#9

@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


#10

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


#11

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.


#12

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.