Problem uploading images

The error here happens when we run the PHP command to move the uploaded file to its final location in the Omeka files directory, and it returns false to indicate the move failed.

PHP itself will log a warning when that command fails. You might check your PHP logs for more information (not the Omeka application log but PHP’s error_log). Here’s some documentation from cPanel about where that log might be located,

Yes, the /public_html/error_log had a couple of entries from my struggle with adding elements in Omka (although way fewer than my failed attempts).
And it’s not clearer to me what’s gone wrong:

[10-Jan-2024 11:53:57 Europe/Berlin] PHP Fatal error:  Uncaught Error: Unknown named parameter $allowTags in /home/samlinge/flesberg.samlinger.no/application/libraries/Zend/Form/Element.php:2117
Stack trace:
#0 /home/samlinge/flesberg.samlinger.no/application/libraries/Zend/Form/Element.php(2117): ReflectionClass->newInstanceArgs()
#1 /home/samlinge/flesberg.samlinger.no/application/libraries/Zend/Form/Element.php(1775): Zend_Form_Element->_loadFilter()
#2 /home/samlinge/flesberg.samlinger.no/application/libraries/Zend/Form/Element.php(595): Zend_Form_Element->getFilters()
#3 /home/samlinge/flesberg.samlinger.no/application/libraries/Zend/Form/Element.php(612): Zend_Form_Element->_filterValue()
#4 /home/samlinge/flesberg.samlinger.no/application/libraries/Zend/Form/Decorator/ViewHelper.php(206): Zend_Form_Element->getValue()
#5 /home/samlinge/flesberg.samlinger.no/application/libraries/Zend/Form/Decorator/ViewHelper.php(236): Zend_Form_Decorator_ViewHelper->getValue()
#6 /home/samlinge/flesberg.samlinger.no/application/libraries/Zend/Form/Element.php(2073): Zend_Form_Decorator_ViewHelper->render()
#7 /home/samlinge/flesberg.samlinger.no/application/libraries/Zend/Form/Decorator/FormElements.php(116): Zend_Form_Element->render()
#8 /home/samlinge/flesberg.samlinger.no/application/libraries/Zend/Form.php(2994): Zend_Form_Decorator_FormElements->render()
#9 /home/samlinge/flesberg.samlinger.no/application/libraries/Omeka/Form.php(171): Zend_Form->render()
#10 /home/samlinge/flesberg.samlinger.no/application/libraries/Zend/Form.php(3010): Omeka_Form->render()
#11 /home/samlinge/flesberg.samlinger.no/plugins/Commenting/CommentingPlugin.php(180): Zend_Form->__toString()
#12 /home/samlinge/flesberg.samlinger.no/plugins/Commenting/CommentingPlugin.php(187): CommentingPlugin::showComments()
#13 /home/samlinge/flesberg.samlinger.no/application/libraries/Omeka/Plugin/Broker.php(154): CommentingPlugin->hookPublicItemsShow()
#14 /home/samlinge/flesberg.samlinger.no/application/libraries/globals.php(188): Omeka_Plugin_Broker->callHook()
#15 /home/samlinge/flesberg.samlinger.no/themes/seasons/items/show.php(13): fire_plugin_hook()
#16 /home/samlinge/flesberg.samlinger.no/application/libraries/Omeka/View.php(114): include('/home/samlinge/...')
#17 /home/samlinge/flesberg.samlinger.no/application/libraries/Zend/View/Abstract.php(889): Omeka_View->_run()
#18 /home/samlinge/flesberg.samlinger.no/application/libraries/Zend/Controller/Action/Helper/ViewRenderer.php(912): Zend_View_Abstract->render()
#19 /home/samlinge/flesberg.samlinger.no/application/libraries/Zend/Controller/Action/Helper/ViewRenderer.php(933): Zend_Controller_Action_Helper_ViewRenderer->renderScript()
#20 /home/samlinge/flesberg.samlinger.no/application/libraries/Zend/Controller/Action/Helper/ViewRenderer.php(972): Zend_Controller_Action_Helper_ViewRenderer->render()
#21 /home/samlinge/flesberg.samlinger.no/application/libraries/Zend/Controller/Action/HelperBroker.php(277): Zend_Controller_Action_Helper_ViewRenderer->postDispatch()
#22 /home/samlinge/flesberg.samlinger.no/application/libraries/Zend/Controller/Action.php(527): Zend_Controller_Action_HelperBroker->notifyPostDispatch()
#23 /home/samlinge/flesberg.samlinger.no/application/libraries/Zend/Controller/Dispatcher/Standard.php(308): Zend_Controller_Action->dispatch()
#24 /home/samlinge/flesberg.samlinger.no/application/libraries/Zend/Controller/Front.php(954): Zend_Controller_Dispatcher_Standard->dispatch()
#25 /home/samlinge/flesberg.samlinger.no/application/libraries/Zend/Application/Bootstrap/Bootstrap.php(106): Zend_Controller_Front->dispatch()
#26 /home/samlinge/flesberg.samlinger.no/application/libraries/Zend/Application.php(384): Zend_Application_Bootstrap_Bootstrap->run()
#27 /home/samlinge/flesberg.samlinger.no/application/libraries/Omeka/Application.php(73): Zend_Application->run()
#28 /home/samlinge/flesberg.samlinger.no/index.php(23): Omeka_Application->run()
#29 {main}
  thrown in /home/samlinge/flesberg.samlinger.no/application/libraries/Zend/Form/Element.php on line 2117

I’m getting different behaviour from uploading .pdf versus uploading a .jpg file. When I try to upload a ,pdf this is what appears on screen and gets written to /home/public_html/{omeka installation folder}/admin/error_log. I’ve not been able to find a php error log file.

This is from up loading a .jpg (~0.5 MB size)

@hknappe Do you have other entries in that log file? Ones relevant to this problem would mention “rename”.

@atrevorsmith The different error you have for PDFs is just specific to the PDFText plugin you’re trying to use. It runs a command on your server, but your server has disabled one of the PHP functions needed for running commands. That’s not related to your uploading problem (but does mean you can’t use PdfText on this server).

In /home/public_html/{omeka installation folder}/application/logs/errors.log I see this:

And the line(s) immediately before what you captured in this screenshot? What you have here is basically a restatement of the error we already know about, but what we’re looking for would be just before.

“but does mean you can’t use PdfText on this server” - so does that mean that I cannot upload .pdf files at all on this server in Omeka. Please explain, is this a restriction that my service provider has imposed? My Omeka installation is out of the box with minimal configuration changes. Doesn’t that use a PDFText plugin that comes with Omeka? How would I change the PDFText plugin to one that works on this server?

Immediately before that is another stack trace with an earlier time stamp (my precious “Save Changes” with a different file.

You can upload PDF files, but you’d have to uninstall or deactivate the PdfText plugin first. PdfText just extracts embedded text from the PDF; it’s not required to upload PDFs.

The restriction that’s making PdfText not work is from your hosting provider. You could ask them about enabling the necessary functions (this one is escapeshellarg, but the shell_exec function is also required), but hosts that disable these functions are often not willing to enable them, or will require you to use a more costly form of hosting in order to do so.

@jflatnes Unfortunately there are only 3 entries in the error_log. They are all like the one pasted above.

OK. I’ve deactivated PdfText plugin and now the behaviour is the same for both .jpg and .pdf. Could running the PdfText plugin be the root cause of the file upload problem?

@hknappe Have you checked your disk space usage? That’s still the best first explanation for a sudden inability to upload files, that you’re just out of space. On some servers you have separate quotas for space just in the public_html folder or similar, just to note a possible complication.

@atrevorsmith No, PdfText shouldn’t have anything to do with this, beyond the one error screen you posted that was unique to PDF uploads.

For both of you: are you able to manually upload a file into the Omeka files/ folder? Say, through cPanel or FTP?

Yes. I uploaded a small image and a largish .PDF with no issues in FTP:

I’m running Omeka 3.1.1. Are there any bugs fixed in Omeka 3.1.2 that could cause this?

There’s really been very little change in the relevant code for storing files in quite some time, and I’m not aware of any outstanding bugs related to it.

I’m low on ideas at this point: you might be best checking with support from your web host.

I have one last possible suggestion, see my post on another user’s thread reporting the same kind of problem recently. It’s worth a try, anyway.

@jflatnes Thanks for your effort and suggestion. I will try that during the weekend. But for the time being I have bypassed the problem by setting up a clean Omeka on another server, and imported all elements with API Importer. And that went well. No problem uploading images on that server.

@jflatnes I’ve finally managed to work on this again and the addition of “storage.adapterOptions.useCopy = true” to application/config/config.ini seems to have worked. I’ll do some more testing though.

Many many thanks. I’ll pursue the pdfText issue with my service provider

My service provider has now enabled the PHP functions that allow PdfTest plugin to work. So all now working again. Thanks