You are viewing the PKP Support Forum | PKP Home Wiki

View PDF files in my browser

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
The Public Knowledge Project Support Forum is moving to http://forum.pkp.sfu.ca

This forum will be maintained permanently as an archived historical resource, but all new questions should be added to the new forum. Questions will no longer be monitored on this old forum after March 30, 2015.

View PDF files in my browser

Postby sciruela » Thu Jan 10, 2008 3:35 am

Hi, I have a problem with pdf files. I have installed adobe plugin for my browser but I can not view pdf file with this. When I clic on a pdf link a window ask me where it save the pdf file. I would like to use my pdf file with my browser. I try use this code to know the default mime_type:

<?php echo 'Mime type: ' . mime_content_type('pdf_file.pdf') . "<br/>\n"; ?>

Their output is :

Mime type: application/octet-stream

How I change this mime type to application/pdf?

Posts: 3
Joined: Fri Jan 04, 2008 1:06 pm

Re: View PDF files in my browser

Postby jmacgreg » Thu Jan 10, 2008 12:09 pm

Hi Scriruela,

It sounds like you're having issues with your mime_content_type configuration. I've copied the following from a previous post:

OJS uses PHP's mime_content_type function to determine file types; if that function doesn't exist, it calls the external UNIX standard "file" utility. Either way, it determines file types based on a file called magic.mime. I'd suggest making sure that PHP's mime_content_type function is properly configured. See http://www.php.net/manual/en/function.m ... t-type.php for information.

The line <?php echo 'Mime type: ' . mime_content_type('pdf_file.pdf') . "<br/>\n"; ?> should return type application/pdf, but it's not, most likely due to a misconfiguation. If you'd like, point me to a pdf file on your server to look at, and I can double-check that it's not a document problem.

Alternatively, you can search the forums for mime_content_type -- this issue has been discussed before.

Posts: 4191
Joined: Tue Feb 14, 2006 10:50 am

Return to OJS Technical Support

Who is online

Users browsing this forum: Google [Bot] and 1 guest