You are viewing the PKP Support Forum | PKP Home Wiki

[Solved] Unusual code when I try to download a pdf

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.

[Solved] Unusual code when I try to download a pdf

Postby stabb » Tue Jun 12, 2007 10:48 am

Hi there Guys.

Im having a little trouble, downloading pdfs from an issue in my journal.

See: http://ojs.review.mai.ac.nz/ojs/
(try to click pdf)
-- My browser displays the encoded article instead of downloading it, not sure if yours will do the same..?.

Both of the issues in the journal were imported via the xml plugin. Im quite sure I replaced all the right; updated files from the cvs, like MJ instructed, but I could have missed something.

Also, i didnt encode the pdf's into the xml, I wouldnt know how. What i did was, I created directories on the web server and linked them in with the export. I did the same, on my home machine and everything works fine.

Any Ideas?

Last edited by stabb on Wed Jul 04, 2007 6:34 pm, edited 1 time in total.
Posts: 47
Joined: Sat Mar 31, 2007 10:06 pm

Postby asmecher » Tue Jun 12, 2007 11:44 am

Hi James,

It looks like OJS thought the PDF files were actually HTML. OJS detects file types using the mime_content_type function; if you search this forum for "mime_content_type" you'll find numerous posts on the subject. I'd suggest using a test script on your server to make sure types are being detected properly; something like:
Code: Select all
<?php echo 'Mime type: ' . mime_content_type('pdf_file.pdf') . "<br/>\n"; ?>
If you place this script on your server and a test PDF called pdf_file.pdf in the same directory, you should be able to call it in order to display the file type.

Alternately, if you imported using HTML files and later re-uploaded PDFs over top of the HTML galleys, that could be the cause of the problem. OJS only detects file types when the file is first uploaded.

Alec Smecher
Public Knowledge Project Team
Don't miss the First International PKP Scholarly Publishing Conference
July 11 - 13, 2007, Vancouver, BC, Canada
Posts: 10015
Joined: Wed Aug 10, 2005 12:56 pm


Postby stabb » Wed Jul 04, 2007 6:33 pm

Just to update: I solved this problem. It turned out, in the database entity article_files, the attribute 'html_galley' had a 1 instead of a 0 for each article that had been imported via my xml file.

I know I used the tag


in the xml file. But im unsure whether there is an alternative tag. Say <galley> etc.
Posts: 47
Joined: Sat Mar 31, 2007 10:06 pm

Re: [Solved] Unusual code when I try to download a pdf

Postby stabb » Sun Aug 12, 2007 10:16 pm

For anyone thats using XML
Make sure you use
<galley></galley> tags unless your importing html. In which case use <htmlgalley></htmlgalley>
Posts: 47
Joined: Sat Mar 31, 2007 10:06 pm

Return to OJS Technical Support

Who is online

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