OJS OCS OMP OHS

You are viewing the PKP Support Forum | PKP Home Wiki



Wrong Content-type when displaying pdf 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.

Wrong Content-type when displaying pdf files

Postby rullrich » Fri May 09, 2014 5:33 am

Hi everybody,

I have a strange problem that I am not able to solve by myself. We are running OJS 2.4.3 with SuSE 11 and mysql, the default installation directory for ojs is a folder inside of apaches documentRoot. The inline display of an articles pdf file works as it should and the server returns the correct content-type application/pdf. However, we want to run our OJS installation within a virtual host environment, and after configuring apache accordingly PDF files don't get displayed, because now OJS returns a content-type of text/html when I try to view or download pdfs. The OJS files are identical to the one used in our default installation (copied with cp -p -r ), and both installations use the same database. I wonder if this maybe is an apache problem, but then why is it working in a subdirectory with the default DocumentRoot but not within a virtualhost?

The problem occurs on the following page: http//ourvirtualhost/article/view/657/341.
Could somebody point me in the right direction, maybe?

Greetings,

Ralf
rullrich
 
Posts: 7
Joined: Thu Dec 13, 2012 6:15 am

Re: Wrong Content-type when displaying pdf files

Postby asmecher » Fri May 09, 2014 9:53 am

Hi Ralf,

Is there a public URL you could send me so I can try this myself?

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

Re: Wrong Content-type when displaying pdf files

Postby giorgiob » Sun Nov 02, 2014 4:01 pm

Hi Ralf,

I do not know if this can help. I have a similar problem on a site that has been running since 2011.
We do not use any virtual hosts. We can visualize archived PDF documents until 2013.
All PDF documents uploaded in 2014 cannot be visualized (but can still be downloaded).

I found out that the content type is wrong in the application database; in table article_files
the attribute file_type should be 'application/pdf' but it is 'application/text-plain:formatted'
instead.

Maybe we have a configuration error somewhere, we are still looking into it.

Anyway, setting the correct mime type in the database seems to solve the
problem for us and PDF files are displayed correctly again.

So, maybe you have a different problem, but it may be worthwhile checking your database.

I hope this helps
Giorgio
giorgiob
 
Posts: 4
Joined: Wed Mar 09, 2011 11:33 am

Re: Wrong Content-type when displaying pdf files

Postby asmecher » Mon Nov 03, 2014 8:32 am

Hi Giorgio,

There is a FAQ entry on file types and how OJS detects them, using different tools depending on what the system supports. You can find details on debugging this kind of problem there.

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


Return to OJS Technical Support

Who is online

Users browsing this forum: albertosa, Yahoo [Bot] and 2 guests