OJS OCS OMP OHS

You are viewing the PKP Support Forum | PKP Home Wiki



ojs 2.4.1 does not upload .css or image files

Are you responsible for making OJS work -- installing, upgrading, migrating or troubleshooting? Do you think you've found a bug? Post in this forum.

Moderators: jmacgreg, btbell, michael, bdgregg, barbarah, asmecher

Forum rules
What to do if you have a technical problem with OJS:

1. Search the forum. You can do this from the Advanced Search Page or from our Google Custom Search, which will search the entire PKP site. If you are encountering an error, we especially recommend searching the forum for said error.

2. Check the FAQ to see if your question or error has already been resolved.

3. Post a question, but please, only after trying the above two solutions. If it's a workflow or usability question you should probably post to the OJS Editorial Support and Discussion subforum; if you have a development question, try the OJS Development subforum.

ojs 2.4.1 does not upload .css or image files

Postby dankomed » Sat Dec 15, 2012 12:15 pm

Dear Team,

I have newly installed ojs 2.4.1 on GoDaddy server but I cannot upload .css or image files. It says error - the file is not the correct file format or upload failed.
The installation of ojs 2.3.7 on the same GoDaddy server however correctly uploads both images and .css files.
Both ojs 2.3.7 and ojs2.4.1 config.inc.php files contain this code:
[finfo]
mime_database_path = /etc/magic.mime
Is the problem connected with misconfiguration of the mime.magic on GoDaddy server, or something else is the cause? I am wondering why the ojs 2.3.7 uploads correctly, whereas ojs 2.4.1 cannot. I checked many times the permissions, and both the /public folder as well as the files_dir folder are writable.
dankomed
 
Posts: 39
Joined: Thu May 03, 2012 8:09 pm

Re: ojs 2.4.1 does not upload .css or image files

Postby asmecher » Mon Dec 17, 2012 11:58 am

Hi dankomed,

I posted about your MIME issues at http://pkp.sfu.ca/support/forum/viewtopic.php?f=8&t=9450&p=36652#p36660.

Regards,
Alec Smecher
Public Knowledge Project Team
asmecher
 
Posts: 8905
Joined: Wed Aug 10, 2005 12:56 pm

Re: ojs 2.4.1 does not upload .css or image files

Postby dankomed » Mon Dec 17, 2012 12:35 pm

Dear Alec, your clarification is great! I am posting here how the upload function of ojs 2.4.1 is restored for those who will have the same problem on GoDaddy server, because previous posts were a bit misleading. Actually there are at least two /classes/core/ folders in ojs. I was looking for String.inc.php in the obvious folder:
/ojs/classes/core/String.inc.php
However, the correct localization is in:
/ojs/lib/pkp/classes/core/String.inc.php

If the mime setting does not work in ojs2.4.1 the code:
Code: Select all
    if (function_exists('mime_content_type')) {

should be changed to:
Code: Select all
    if (false && function_exists('mime_content_type')) {

in order to instruct OJS not to use PHP's mime_content_type function. Now with ojs 2.4.1 working I will fix the ISSN export by the OAI.
dankomed
 
Posts: 39
Joined: Thu May 03, 2012 8:09 pm

Re: ojs 2.4.1 does not upload .css or image files

Postby burdzy » Sun Jun 02, 2013 10:28 am

I have installed OJS 2.4.2 a few days ago.
Upload of css file does not work. I get the error
" Errors occurred processing this form:
Invalid journal stylesheet format. Accepted format is .css."
The file does have .css extension (on Win 7).
The above problem exists despite the fact that I changed the line
if (function_exists('mime_content_type')) {
to
if (false && function_exists('mime_content_type')) {
in the file /ojs/lib/pkp/classes/core/String.inc.php.
Anything else that I could try?
Thanks, Chris

P.S. I have just tried the following posted solution:

Re: Invalid homepage header title image format
Postby schiette » Fri Nov 28, 2008 10:27 am
Follow up on my previous message: I finally solved the problem by replacing, in function getUploadedFileType($fileName), the following line:

Code: Select all
$type = String::mime_content_type($_FILES[$fileName]['tmp_name']);

by

Code: Select all
$type = String::mime_content_type($_FILES[$fileName]['name']);

so the actual file name, with extension, is passed as argument to function mime_content_type() rather than the temporary file name that has no extension.

It did not work either.
Chris
burdzy
 
Posts: 19
Joined: Mon Nov 23, 2009 7:15 pm

Re: ojs 2.4.1 does not upload .css or image files

Postby burdzy » Sun Jun 02, 2013 3:49 pm

Please ignore my last post. The css appeared to have some problems
(although I copied it from an existing OJS journal). I made some changes
to css file and it uploaded fine.
Chris
burdzy
 
Posts: 19
Joined: Mon Nov 23, 2009 7:15 pm

Re: ojs 2.4.1 does not upload .css or image files

Postby rootl » Wed Oct 23, 2013 7:05 am

Curious -what were the changes? We sometimes receive 'invalid file type' messages when uploading custom stylesheets, but not all the time.

We go through the syntax and markup thoroughly and haven't figured out what causes the error. Thanks.
rootl
 
Posts: 62
Joined: Wed Feb 20, 2013 7:17 am

Re: ojs 2.4.1 does not upload .css or image files

Postby asmecher » Wed Oct 23, 2013 8:27 am

Hi rootl,

Have a look e.g. at http://pkp.sfu.ca/support/forum/viewtopic.php?f=8&t=908; there are a few things to check as well as some background info.

Regards,
Alec Smecher
Public Knowledge Project Team
asmecher
 
Posts: 8905
Joined: Wed Aug 10, 2005 12:56 pm

Re: ojs 2.4.1 does not upload .css or image files

Postby rootl » Thu Oct 24, 2013 5:29 am

Thanks, Alec for the link to this thread. Our ojs instance is running on a Windows server, PHP version 5.3

It seems comments in the css were the big problem. Also gradient css code.


We have the same css upload problem on OMP which is hosted on an Amazon instance, even with comments stripped out and only overrides of default css code. I found a way to directly copy the css file to its appropriate press area on the server, overwrite the existing file, then copy and rename it as .pressStyleSheet It is a convoluted method but it works, loads fairly quickly, and we can keep comments in the css.
rootl
 
Posts: 62
Joined: Wed Feb 20, 2013 7:17 am


Return to OJS Technical Support

Who is online

Users browsing this forum: No registered users and 9 guests