None of the PDF files can be viewed or downloaded after Upgraded to OJS 3

Hi @Bahattab,

Is the files directory publicly accessible via the web server? If so, that’s a security hole. Make sure you’ve protected your files area either by moving it out of the web root or by using a .htaccess file to restrict direct access.

What version of OJS did you upgrade from? During the upgrade, did you receive any warning messages?

Regards,
Alec Smecher
Public Knowledge Project Team

the files directory publicly is not accessible via the web server
I upgrade from version of OJS 2.8 to 3.x
How to us the .htaccess file to restrict direct access?
During the upgrade, i did not receive any warning messages.

but i still can’t view or download the documents ?

how can i fix that ?

Hi @Bahattab,

If your files directory is not publicly accessible, then you don’t need to worry about a .htaccess file. (If you’re curious about restricting access using .htaccess, search for “basic authentication htaccess” in Google.)

Check what version you upgraded from – there is no such thing as OJS 2.8.

Regards,
Alec Smecher
Public Knowledge Project Team

i don’t remember it is the latest befor OJS 3 may be 2.4.x

but in anycase documents files are not working .

do you have solution ?

Hi @Bahattab,

You can check what version you upgraded from by looking in the versions table of your database:

SELECT * FROM versions WHERE product='ojs2';

Have a look in your files directory for a few example files. What kinds of filenames do you see?

Regards,
Alec Smecher
Public Knowledge Project Team

Hi @asmecher,

I have the same problem. I have upgraded from 2.4.6 to 3.0.1. the file name I have got in my files/journals/[journal_number]/articles/[article_number]/public/ is 300-1694-1-PB.pdf
Are we restricted in filenames?

Regards
Ghazal

Hi @salehig,

Those look like OJS 2.x style filenames. The upgrade to OJS 3.x includes renaming them to OJS 3.x style. If your files didn’t get renamed, but the upgrade process completed successfully, then it suggests that OJS didn’t have enough permissions to rename the files. In that case you should’ve received a warning message about each file that couldn’t be renamed.

Regards,
Alec Smecher
Public Knowledge Project Team

Thanks @asmecher. I don’t remember receiving those warnings. Are they logged in log files? Is there any way to rename them manually?

Thanks
Ghazal

I had upgraded using command line php tools/upgrade.php upgrade.

Hi @salehig,

Those are sent to the PHP error log as warnings, so depending on your PHP settings, they could go to a log file, or the browser/command line, or both.

If you’re able, I’d suggest unpacking up a backup of your files directory and database and try running an upgrade on that to see whether it results in your files getting renamed, or warning messages.

Regards,
Alec Smecher
Public Knowledge Project Team

Would you please direct me to the codes which are responsible to rename the files?

Hi @salehig,

That’s in classes/install/Upgrade.inc.php – in the migrateFiles function.

Regards,
Alec Smecher
Public Knowledge Project Team

Thanks heaps. I did another upgrade after I changed the permission and owner of files directory and it seems to be working, although I get a couple of “WARNING: Unable to find a match for…” warnings and also “Invalid argument supplied for foreach” on line 1263 and 1273 of Upgrade.inc.php

What I had done initially was copying the exact file structure of files directory of the old version and copied into the new version which apparently wouldn’t work.

Best Regards
Ghazal

Hi @salehig,

A couple of warnings isn’t atypical for an install that’s been around for a while – it’s worth checking them to see what’s missing.

Regards,
Alec Smecher
Public Knowledge Project Team

I have same issue after upgrade 2.x to 3.x I cant see any html/pdf files on the browser… Can anyone help me to solve this issue?

Thanks!

Hi @bluechiptec,

Can you post the output of the upgrade process? It attempts to rename files, and if it can’t, this situation will result. It should have given you warnings about e.g. file permissions during the upgrade.

Regards,
Alec Smecher
Public Knowledge Project Team

Upgrade process was successful, there was no issue during the process.
Please let me know which folder have the issue of permission, here I can see all have 755 write permission or are you talking about anything else.

I have seen all the PDF articles are existing at “public_html/upload/journals/2/articles/10/public”

Hi @bluechiptec,

Have you protected the upload directory against direct access via the web server? If not, your system may be vulnerable to malicious uploads. See e.g. docs/README.

Regards,
Alec Smecher
Public Knowledge Project Team

Yes, it was accessible via web “domain.com/upload” but nothing I have changed, was upgraded via “softaculoua and rest of the process”

and now protected by htacess.
But still have same issue
“PDF.js v1.0.907 (build: e9072ac)
Message: stream must have data”

Also users are unable to login with their existing credentials.
Please help me.

Hi all,

@Andrzej, the original question on this thread is about upgrades and I’m not sure your situation is the same. Can you post your question as a new thread?

@bluechiptec, what version of PHP are you running?

Regards,
Alec Smecher
Public Knowledge Project Team