OJS OCS OMP OHS

You are viewing the PKP Support Forum | PKP Home Wiki



HELP!! Submission files corrupted by server!

Are you an Editor, Author, or Journal Manager in need of help? Want to talk to us about workflow issues? This is your forum.

Moderators: jmacgreg, michael, vgabler, John

Forum rules
This forum is meant for general questions about the usability of OJS from an everyday user's perspective: journal managers, authors, and editors are welcome to post questions here, as are librarians and other support staff. We welcome general questions about the role of OJS and how the workflow works, as well as specific function- or user-related questions.

What to do if you have general, workflow or usability questions about OJS:

1. Read the documentation. We've written documentation to cover from OJS basics to system administration and code development, and we encourage you to read it.

2. take a look at the tutorials. We will continue to add tutorials covering OJS basics as time goes on.

3. Post a question. Questions are always welcome here, but if it's a technical question you should probably post to the OJS Technical Support subforum; if you have a development question, try the OJS Development subforum.

HELP!! Submission files corrupted by server!

Postby ramon » Fri Apr 16, 2004 8:17 am

Dear fellows,

We have what seems to be a simple problem to solve, but not being knowledgeable of Linux and servers and php and can´t solve this.

When we send a file to the server it corrupts something in it, adding header information, changing character sets, and so on.

here´s an example of changes.

""
aqueles que sempre quiseram dela ser sujeito. Insisto em dizer que nunca houve Judiciário tão transparente quanto o Judiciário brasileiro. Aqui os julgamentos sempre se fizeram a portas abertas, desde a primeira constituição republicana. Necessitamos, sim, dúvidas não há -ð e s s e s e m p r e f o i m e u d i s c u r s o -ð, d e u m c o n t r o l e , m a s f e i t o p o r p e s s o a s o u m e m b r o s d o J u d i c i á r i o , p o i s o c o n t r o l e e x t e r n o f e r e o s m a i s c o m e z i n h o s p r i n c í p i o s j u r í d i c o s .
O S u p e r i o r , e m f a c e d i s s o , d e s e m p e n h a s e u p a p e l c o m p r o p o s t a s r e m e t i d a s a o C o n g r e s s o N a c i o n a l e p o n t o s d e v i s t a e x p r e s s o s e d e f e n d i d o s B r a s i l a f o r a , à s v e z e s s o l i t á r i o , c o n t u d o s e m j a m a i s p e r d e r a f o r ç a e a f é , p o r q u e s a b e -ð a l i á s , t o d o s o s a b e m o s -ð q u e s u a s p r o p o s t a s s e m p r e f o r a m e s e r ã o e m n o m e d o j u r i s d i c i o n a d o , t a n t o q u e , e n t r e o u t r a s c o memorações, nossas propostas receberam o seguinte editorial do jornal O Estado de S. Paulo: (...) conjunto de sugestões... destinadas a """

NOTE: When pasting from Word what was originally a bunch of squares is now that text in a different format and font


Does anyone know how to solve this???

I cannot send the file, but when comparing the different files and what we copied, we can see that Word inserts a special dash when typing "-"... and that´s where one of the error starts...

but that´s not all...

How can I upload the corrupted file to show you?

the server is using Slackware with apache 1.3.27, php 4.3.1, MySQL 3.23.56...


thanks
ramon
 
Posts: 931
Joined: Wed Oct 15, 2003 6:15 am
Location: Brasí­lia/DF - Brasil

Postby kevin » Fri Apr 16, 2004 11:32 am

What type of file is this? If it's a binary file (Word doc. PDF, etc.) then I don't think OJS could be the problem, as it just uses PHP's move_uploaded_file() to move the uploaded file from one location to another.

If it's an HTML file uploaded in the galley I think there's some actual parsing of the file involved.
kevin
 
Posts: 338
Joined: Tue Oct 14, 2003 8:23 pm

Corrupted files cont.

Postby ramon » Fri Apr 16, 2004 11:46 am

The file is a regular .doc.

When we use regular FTP or access the files folder directly the file is not corrupted.

Something happens to the file when we choose to view it when clicking the links within OJS.

Nome do arquivo (Original): NilsonNavesAcessoJustiça.doc

Nome do arquivo (Novo): revcej-2004-7.doc

Tamanho: 34.5 KB

Transferido em: Apr 16, 2004 - 3:13 PM
ramon
 
Posts: 931
Joined: Wed Oct 15, 2003 6:15 am
Location: Brasí­lia/DF - Brasil

Postby kevin » Fri Apr 16, 2004 12:31 pm

I see. Would it be possible for you to email me (or post a link to) the uncorrupted file so I can try to repeat this behaviour?
kevin
 
Posts: 338
Joined: Tue Oct 14, 2003 8:23 pm

Postby kevin » Fri Apr 16, 2004 12:33 pm

This might work... Try adding this extra header in include/getdoc.php and admin/include/getdoc.php:

Code: Select all
header("Content-Transfer-Encoding: binary");
kevin
 
Posts: 338
Joined: Tue Oct 14, 2003 8:23 pm

Corrupted files cont. 2

Postby ramon » Fri Apr 16, 2004 1:03 pm

Dear fellows,

To fix the corrupted files problem we had to change the following files:

/ojs/include/getdoc.php
/ojs/admin/include/getdoc.php

The following code was added:
Code: Select all
<?php

ob_start();
// $Id: getdoc.php,v 1.27 2003/07/13 02:42:35 kevin Exp $



then close to the end of the file:

Code: Select all

// Public files are downloadable by everyone
        ob_end_clean();


This sanitizes the buffer in some servers that need this. We don´t know why this is necessary, because we have another server that works fine without this fix.

thanks
ramon
 
Posts: 931
Joined: Wed Oct 15, 2003 6:15 am
Location: Brasí­lia/DF - Brasil

Postby kevin » Fri Apr 16, 2004 2:12 pm

That is odd. Unless there is some output (e.g., a PHP warning or error message) before the file is output that should not be necessary. If you exit() right before the header() function calls is there any output sent to the browser?
kevin
 
Posts: 338
Joined: Tue Oct 14, 2003 8:23 pm

exit header()

Postby ramon » Mon Apr 19, 2004 1:06 pm

We didn´t try that.

We found that fix in another server installation and that was it... We tried to use the
Code: Select all
header("Content-Transfer-Encoding: binary");
but that didn´t work.
The PHP variable settings are the same, that´s why we don´t know why the ob_start() fix is necessary.

It may have something to do with the firewall.

We might try exiting the function later to check the output. If we do I´ll let you know what happens.
ramon
 
Posts: 931
Joined: Wed Oct 15, 2003 6:15 am
Location: Brasí­lia/DF - Brasil

corrupted .doc files

Postby jozoraz » Mon Mar 13, 2006 2:36 am

hi!
i just installed OJS 2.1 and i have the same problem as mentioned above.
the uploaded .doc documents are corrupted when opened via a link from OJS. when i open the .doc file directly from the location it is stored on server, everythink is ok. please help

i'm using windows XP SP2, php 4.4.2, mySQL 5.0, IIS
jozoraz
 
Posts: 5
Joined: Mon Mar 13, 2006 2:30 am

Postby asmecher » Mon Mar 13, 2006 10:39 am

Hi jozoraz,

Have you tried the fixes suggested in this thread? For OJS 2.x, try modifying the downloadFile function in classes/file/FileManager.inc.php. I'd also suggest trying a different browser to see if the behaviour might be browser-specific. Please post your results here in case someone else runs into the same problem.

Regards,
Alec Smecher
Open Journal Systems Team
asmecher
 
Posts: 8851
Joined: Wed Aug 10, 2005 12:56 pm

Having the same problem.

Postby Eleanore » Tue Mar 14, 2006 11:48 am

We just installed for the first time to test it and see if it's the software we want to use but we are not able to upload .doc files.

If I remain logged in as an author I click on the file and it opens it in word - no problem.

If I log out and log in as manager and try to view the file I first get the following error at the top of the page.

Warning: shell_exec() has been disabled for security reasons in /usr/local/psa/home/vhosts/itinet.org/httpdocs/online/classes/core/String.inc.php on line 209

Warning: Cannot modify header information - headers already sent by (output started at /usr/local/psa/home/vhosts/itinet.org/httpdocs/online/classes/core/String.inc.php:209) in /usr/local/psa/home/vhosts/itinet.org/httpdocs/online/classes/template/TemplateManager.inc.php on line 179

Then it tries to open the file in the browser and the file looks like this

ÐÏࡱá>þÿ œžþÿÿÿš›ÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿì¥Á` ð¿ymbjbjæ‡æ‡ .?„í„íž\µ%ÿÿÿÿÿÿ¤   š¦l&N:N:N:8†:<Â:L&Lk ;;"<;<;<;<<<«j­j­j­j­j­j­j$ìlhTonÑjÇ=<<Ç=Ç=Ñj<;<;Ûæj*Å@Å@Å@Ç=v<;<;«jÅ@Ç=«jÅ@Å@Šf³i<;; à~#èFÆN:=>Лg"—jkU<,Å@?<$¥<"<<<ÑjÑj[@j<<>\A]A>BúúúúñññúúéÝÔÔúÈúúúúúú $ Æa$gd‡8ð $7$8$H$a$ $7$8$H$a$gdx$a$gdx$„h`„ha$$a$÷4þ45[5\5a5¸5¾5º6»6¿6â6ã6í675777A7J7V7W7b7?7…7‘7©7½7¾748L8Ü8Ý8ß8à8ä8ô8ù8T9l9¤9Ã9^;«;¬;­;®;¯;ùòëÞë×ùëÞëùëÐëÐëÉëмÐ×ÐëÐëÐëùë¼ëµ®µ®µ§µ®µ® “ˆzhZIPhx6?B* ]?ph€hZIPhxOJQJjhZIPhÅ@0JU hZIPhýlE hZIPh4@š hZIPhÅ@ hZIPhxjhZIPhþD¢0JU hZIPhÙN hZIPh±  hZIPhï3DjhZIPhR`0JU hZIPhR` hZIPhc
Eleanore
 
Posts: 1
Joined: Tue Mar 14, 2006 11:35 am

Postby asmecher » Tue Mar 14, 2006 12:33 pm

Hi Eleanore,

The problem is that your server doesn't support PHP's mime_content_type function and also has restrictions on executing external programs. Usually when OJS encounters a system that doesn't support mime_content_type, it uses the system's "file" tool as a fallback. However, your server has disabled this as well.

One work-around for this would be to use the approach suggested at http://ca3.php.net/manual/en/function.mime-content-type.php#52388; this code would need to be added to the mime_content_type function defined in classes/core/String.inc.php.

Regards,
Alec Smecher
Open Journal Systems Team
asmecher
 
Posts: 8851
Joined: Wed Aug 10, 2005 12:56 pm

Postby jozoraz » Fri Mar 17, 2006 1:35 am

the fixes mentioned above dont longer apply to OJS 2.x because the paths described dont longer exist. i tried to add an header in the file classes\file\FileManager.inc.php :

Code: Select all
         header("Content-Type: $type");
         header("Content-Transfer-Encoding: binary");
         header("Content-Length: ".filesize($filePath));
         header("Content-Disposition: " . ($inline ? 'inline' : 'attachment') . "; filename=\"" .basename($filePath)."\"");
         header("Cache-Control: private"); // Workarounds for IE weirdness
         header("Pragma: public");


but no success. still having the same bug. please help
jozoraz
 
Posts: 5
Joined: Mon Mar 13, 2006 2:30 am

Postby asmecher » Fri Mar 17, 2006 10:48 am

Hi Jozoraz,

Look at classes/file/FileManager.inc.php; you might correct the problem by changing the following line in the readFile function from:
Code: Select all
$f = fopen($filePath, 'r');
to:
Code: Select all
$f = fopen($filePath, 'rb');
Please report your results here.

Regards,
Alec Smecher
Open Journal Systems Team
asmecher
 
Posts: 8851
Joined: Wed Aug 10, 2005 12:56 pm

Postby jozoraz » Mon Mar 20, 2006 1:53 am

Code: Select all
$f = fopen($filePath, 'rb');


it didnt fix the problem :(

there is no problem with PDF files. only .doc files have this strange behaviour. and there is no difference if i open the file directly or download it and then open. i tried firefox and IE

any other suggestions.
Last edited by jozoraz on Mon Mar 20, 2006 2:25 am, edited 1 time in total.
jozoraz
 
Posts: 5
Joined: Mon Mar 13, 2006 2:30 am

Next

Return to OJS Editorial Support and Discussion

Who is online

Users browsing this forum: No registered users and 1 guest