OJS OCS OMP OHS

You are viewing the PKP Support Forum | PKP Home Wiki



Unable to upload files to Galley

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.

Unable to upload files to Galley

Postby aleurm » Thu Mar 15, 2007 8:59 pm

Hi Alec,

I saw few topics about this problem but wanted a quick advise on how to fix it. We've been using OJS over a year w/o any problems. We use Yahoo web hosting so we have no access to php.ini file etc. Everything was working fine until recently. I guess they upgraded their php. Now when we trying to upload files into Galley we get a blank screen.

I copied ini_set('display_errors', E_ALL); into index.php and got the following error:

Fatal error: mime_magic could not be initialized, magic file /usr/share/misc/magic.mime is not available in /classes/core/String.inc.php on line 216

What is the easiest way to fix this? Ask Yahoo support to put something in php.ini file? what exatcly should be there?

We use OJS 2.1.0. Is the new version solves this problem?

Thanks,
Aleksey
aleurm
 
Posts: 3
Joined: Thu Mar 15, 2007 8:48 pm

Postby asmecher » Thu Mar 15, 2007 9:51 pm

Hi Aleksey,

I'd suggest contacting Yahoo, as it's probably an oversight on their part. Alternately, you could try something like this near where you added your other ini_set directive:
Code: Select all
ini_set("mime_magic.magicfile", "/path/to/magic.mime");
...setting the path appropriately and uploading a valid magic.mime file.

However, I'm not sure off the top of my head whether or not the mime magic file can be configured at runtime.

Regards,
Alec Smecher
Open Journal Systems Team
---
Don't miss the First International PKP Scholarly Publishing Conference
July 11 - 13, 2007, Vancouver, BC, Canada
http://ocs.sfu.ca/pkp2007/
asmecher
 
Posts: 9099
Joined: Wed Aug 10, 2005 12:56 pm

Postby aleurm » Fri Mar 16, 2007 1:07 am

Thanks Alec. I tried unsuccessfully your suggestion. Still produces the same error. I'm just going to return "application/pdf" in the function mime_content_type($filename) in classes/core/String.inc.php. This works for us very well, since we use only pdf galley format. Is there any issue this can cause? Is mime_content_type used elsewhere in OJS?

Aleksey
aleurm
 
Posts: 3
Joined: Thu Mar 15, 2007 8:48 pm

Postby asmecher » Fri Mar 16, 2007 8:30 am

Hi Aleksey,

That will definitely cause problems with other file types -- I'd suggest checking to see if the built-in work-around based on the "file" utility is allowed in your environment. Try changing line approx. #206 in classes/core/String.inc.php from:
Code: Select all
if (function_exists('mime_content_type')) {
...to...
Code: Select all
if (false && function_exists('mime_content_type')) {
This will prevent OJS from using the mime_content_type function. Depending on Yahoo's security settings, the built-in work-around may not be available.

Alternately, if Yahoo has the fileinfo extension enabled, see http://pkp.sfu.ca/support/forum/viewtopic.php?p=5269#5269 for yet another work-around. (You'll have to make the above modification to this too, or it'll try to use mime_content_type.)

If these don't work, I'd suggest hacking something into place that will trust file extensions it's sent by remote browsers. This is less than ideal, but you may not have an alternative.

Regards,
Alec Smecher
Open Journal Systems Team
---
Don't miss the First International PKP Scholarly Publishing Conference
July 11 - 13, 2007, Vancouver, BC, Canada
http://ocs.sfu.ca/pkp2007/
asmecher
 
Posts: 9099
Joined: Wed Aug 10, 2005 12:56 pm

Postby aleurm » Sat Mar 17, 2007 12:31 am

Hi Alec,

I replaced line in classes/core/String.inc.php

if (!function_exists('mime_content_type')) {

with just

if (true) {

to force it to use the build-in work-around with the file utility. Works nicely. Thanks a lot.

Best regards,
Aleksey
aleurm
 
Posts: 3
Joined: Thu Mar 15, 2007 8:48 pm


Return to OJS Technical Support

Who is online

Users browsing this forum: Google [Bot] and 2 guests