Inconsistency with file uploads

I’ve got inconsistency between environments with regards to the file types I am able to upload, all are OJS v 3.1.1.2.

Some instances allow CSS and PNG to be uploaded but not JPG and some allow JPG but not PNG and another instance that cannot upload anything. I am restricted in that I cannot personally view the permissions settings in order to do direct comparisons and I’m being told they all match and that it must be a program problem. Given they are the same version I struggle to believe this. Any advice would be gratefully received. I have played around with the mime.type settings mentioned in other threads with no noticeable affect.

Hi @loola

As I know, OJS doesn’t provide any restrictions on file upload types by default. Can you double check if is not server-related issue?

Also, can it be somehow related to the maximum size of file upload in the php config: upload_max_filesize and post_max_size in php.ini?

I keep hitting a bit of a blank wall when talking to the people that maintain the server unfortunately.

I’ve checked the items you’ve suggested and they are actually a higher allowance on the ones not allowing uploads.

I’m also getting different behaviours between what file types can be uploaded at a site level versus a journal level. Any ideas gratefully received.

It’s hard to say where the problem is without additional information…

Do you have an access to PHP error logs? Are there any errors when you encounter with problematic uploads?

Hi,

Some of the errors are below - I’ve anonymised the specific site information (e.g. replaced locations with …/). I can see that files appear to reach the temp folder in some instances. I’ve checked the phpinfo and can’t see anything beyond the expected differences in tokens etc.

[25-Sep-2018 08:33:36 UTC] PHP Fatal error: Uncaught Error: Call to a member function getId() on null in …/lib/pkp/controllers/grid/notifications/TaskNotificationsGridHandler.inc.php:30
Stack trace:
#0 …/lib/pkp/classes/controllers/grid/GridHandler.inc.php(311): TaskNotificationsGridHandler->loadData(Object(Request), NULL)
#1 …/lib/pkp/classes/controllers/grid/GridHandler.inc.php(1034): GridHandler->getGridDataElements(Object(Request))
#2 …/lib/pkp/classes/controllers/grid/GridHandler.inc.php(927): GridHandler->renderGridBodyPartsInternally(Object(Request))
#3 …/lib/pkp/classes/controllers/grid/GridHandler.inc.php(642): GridHandler->doSpecificFetchGridActions(Array, Object(Request), Object(TemplateManager))
#4 …/lib/pkp/classes/core/PKPRouter.inc.php(372): GridHandler->fetchGrid(Array, Object(Request))
#5 …/lib/ in …/lib/pkp/controllers/grid/notifications/TaskNotificationsGridHandler.inc.php on line 30
[25-Sep-2018 08:33:47 UTC] PHP Fatal error: Uncaught Error: Call to a member function getId() on null in …/lib/pkp/controllers/tab/settings/form/SettingsFileUploadForm.inc.php:122
Stack trace:
#0 …/lib/pkp/controllers/tab/settings/AdminSettingsTabHandler.inc.php(91): SettingsFileUploadForm->uploadFile(Object(Request))
#1 …/lib/pkp/classes/core/PKPRouter.inc.php(372): AdminSettingsTabHandler->uploadFile(Array, Object(Request))
#2 …/lib/pkp/classes/core/PKPComponentRouter.inc.php(256): PKPRouter->_authorizeInitializeAndCallRequest(Array, Object(Request), Array)
#3 …/lib/pkp/classes/core/Dispatcher.inc.php(134): PKPComponentRouter->route(Object(Request))
#4 …/lib/pkp/classes/core/PKPApplication.inc.php(247): Dispatcher->dispatch(Object(Request))
#5 …/index.php(68): PKPApplication->execute()
#6 {main}
thrown in …/lib/pkp/controllers/tab/settings/form/SettingsFileUploadForm.inc.php on line 122
[25-Sep-2018 08:45:17 UTC] PHP Fatal error: Uncaught Error: Call to a member function getLocalizedTitle() on null in …/lib/pkp/controllers/grid/notifications/NotificationsGridCellProvider.inc.php:156
Stack trace:
#0 …/lib/pkp/controllers/grid/notifications/NotificationsGridCellProvider.inc.php(44): NotificationsGridCellProvider->_getTitle(Object(Notification))
#1 …/lib/pkp/classes/controllers/grid/GridCellProvider.inc.php(56): NotificationsGridCellProvider->getCellActions(Object(Request), Object(GridRow), Object(GridColumn))
#2 …/lib/pkp/classes/controllers/grid/GridHandler.inc.php(1106): GridCellProvider->render(Object(Request), Object(GridRow), Object(GridColumn))
#3 …/lib/pkp/classes/controllers/grid/GridHandler.inc.php(1013): GridHandler->_renderCellInternally(Object(Request), Object(GridRow), Object(GridColumn))
#4 …/lib/pkp/classes/controllers/grid/GridHandler.inc.php(990): GridHandler-> in /data/WWW/htdocs/devjournals/lib/pkp/controllers/grid/notifications/NotificationsGridCellProvider.inc.php on line 156
[25-Sep-2018 08:45:19 UTC] PHP Fatal error: Uncaught Error: Call to a member function getLocalizedTitle() on null in …/lib/pkp/controllers/grid/notifications/NotificationsGridCellProvider.inc.php:156
Stack trace:
#0 …/lib/pkp/controllers/grid/notifications/NotificationsGridCellProvider.inc.php(44): NotificationsGridCellProvider->_getTitle(Object(Notification))
#1 …/lib/pkp/classes/controllers/grid/GridCellProvider.inc.php(56): NotificationsGridCellProvider->getCellActions(Object(Request), Object(GridRow), Object(GridColumn))
#2 …/lib/pkp/classes/controllers/grid/GridHandler.inc.php(1106): GridCellProvider->render(Object(Request), Object(GridRow), Object(GridColumn))
#3 …/lib/pkp/classes/controllers/grid/GridHandler.inc.php(1013): GridHandler->_renderCellInternally(Object(Request), Object(GridRow), Object(GridColumn))
#4 …/lib/pkp/classes/controllers/grid/GridHandler.inc.php(990): GridHandler-> in …/lib/pkp/controllers/grid/notifications/NotificationsGridCellProvider.inc.php on line 156

The second error is associated with File uploads. And together with the first one, it occurs because user object cannot be retrieved.

Looking further into getUser() method I see that it can return null in case if user data could not be retrieved from the current Session (anonymous user) or the session is broken (timed out or interrupted). Perhaps, @asmecher knows more.

Is there fileinfo PHP module installed on server or restrictions imposed by hosting company? Do you work behind proxy network at your university?

that’s odd. I’ve tried creating a new user and using that with no joy. What I have noticed is that if I make a brand new journal that allows all file uploads. doesn’t solve the site level inconsistencies between css, jpg and png uploads though.

fileinfo in installed. I am unable to comment on our network setup.