Problem uploading images

Hello,

All of a sudden we are not able to upload images to Omeka. Adding pure text-based entries is no problem, but if we want to attach am image to the post, we recieve an “Omeka has encountered an error”. From the logs I get this:

2024-01-10T14:04:13+01:00 ERR (3): Omeka_Storage_Exception: Unable to store file. in /home/samlinge/flesberg.samlinger.no/application/libraries/Omeka/Storage/Adapter/Filesystem.php:130
Stack trace:
#0 /home/samlinge/flesberg.samlinger.no/application/libraries/Omeka/Storage.php(67): Omeka_Storage_Adapter_Filesystem->store('/tmp/e2b05b74b8...', 'original/e2b05b...')
#1 /home/samlinge/flesberg.samlinger.no/application/models/File.php(428): Omeka_Storage->__call('store', Array)
#2 /home/samlinge/flesberg.samlinger.no/application/models/Job/FileProcessUpload.php(23): File->storeFiles()
#3 /home/samlinge/flesberg.samlinger.no/application/libraries/Omeka/Job/Dispatcher/Adapter/Synchronous.php(25): Job_FileProcessUpload->perform()
#4 /home/samlinge/flesberg.samlinger.no/application/libraries/Omeka/Job/Dispatcher/Default.php(137): Omeka_Job_Dispatcher_Adapter_Synchronous->send('{"className":"J...', Array)
#5 /home/samlinge/flesberg.samlinger.no/application/models/File.php(205): Omeka_Job_Dispatcher_Default->send('Job_FileProcess...', Array)
#6 /home/samlinge/flesberg.samlinger.no/application/libraries/Omeka/Record/AbstractRecord.php(281): File->afterSave(Array)
#7 /home/samlinge/flesberg.samlinger.no/application/libraries/Omeka/Record/AbstractRecord.php(549): Omeka_Record_AbstractRecord->runCallbacks('afterSave', Array)
#8 /home/samlinge/flesberg.samlinger.no/application/models/Item.php(338): Omeka_Record_AbstractRecord->save()
#9 /home/samlinge/flesberg.samlinger.no/application/models/Item.php(251): Item->saveFiles()
#10 /home/samlinge/flesberg.samlinger.no/application/libraries/Omeka/Record/AbstractRecord.php(281): Item->afterSave(Array)
#11 /home/samlinge/flesberg.samlinger.no/application/libraries/Omeka/Record/AbstractRecord.php(549): Omeka_Record_AbstractRecord->runCallbacks('afterSave', Array)
#12 /home/samlinge/flesberg.samlinger.no/application/libraries/Omeka/Controller/AbstractActionController.php(204): Omeka_Record_AbstractRecord->save(false)
#13 /home/samlinge/flesberg.samlinger.no/application/controllers/ItemsController.php(148): Omeka_Controller_AbstractActionController->addAction()
#14 /home/samlinge/flesberg.samlinger.no/application/libraries/Zend/Controller/Action.php(516): ItemsController->addAction()
#15 /home/samlinge/flesberg.samlinger.no/application/libraries/Zend/Controller/Dispatcher/Standard.php(308): Zend_Controller_Action->dispatch('addAction')
#16 /home/samlinge/flesberg.samlinger.no/application/libraries/Zend/Controller/Front.php(954): Zend_Controller_Dispatcher_Standard->dispatch(Object(Zend_Controller_Request_Http), Object(Zend_Controller_Response_Http))
#17 /home/samlinge/flesberg.samlinger.no/application/libraries/Zend/Application/Bootstrap/Bootstrap.php(106): Zend_Controller_Front->dispatch()
#18 /home/samlinge/flesberg.samlinger.no/application/libraries/Zend/Application.php(384): Zend_Application_Bootstrap_Bootstrap->run()
#19 /home/samlinge/flesberg.samlinger.no/application/libraries/Omeka/Application.php(73): Zend_Application->run()
#20 /home/samlinge/flesberg.samlinger.no/admin/index.php(28): Omeka_Application->run()
#21 {main}

I’m not fluent in debugging error messages. Anyone with an idea of what’s gone wrong here?

Omeka can’t write the uploaded file into your “files” folder. As first steps I’d check that there’s sufficient disk space, and check the permissions on the files folder.

I’m getting almost identical errors

Omeka_Storage_Exception: Unable to store file. in /home/emhttest/public_html/emcms/application/libraries/Omeka/Storage/Adapter/Filesystem.php:130
Stack trace:
#0 /home/emhttest/public_html/emcms/application/libraries/Omeka/Storage.php(67): Omeka_Storage_Adapter_Filesystem->store()
#1 /home/emhttest/public_html/emcms/application/models/File.php(428): Omeka_Storage->__call()
#2 /home/emhttest/public_html/emcms/application/models/Job/FileProcessUpload.php(23): File->storeFiles()
#3 /home/emhttest/public_html/emcms/application/libraries/Omeka/Job/Dispatcher/Adapter/Synchronous.php(25): Job_FileProcessUpload->perform()
#4 /home/emhttest/public_html/emcms/application/libraries/Omeka/Job/Dispatcher/Default.php(137): Omeka_Job_Dispatcher_Adapter_Synchronous->send()
#5 /home/emhttest/public_html/emcms/application/models/File.php(205): Omeka_Job_Dispatcher_Default->send()
#6 /home/emhttest/public_html/emcms/application/libraries/Omeka/Record/AbstractRecord.php(281): File->afterSave()
#7 /home/emhttest/public_html/emcms/application/libraries/Omeka/Record/AbstractRecord.php(549): Omeka_Record_AbstractRecord->runCallbacks()
#8 /home/emhttest/public_html/emcms/application/models/Item.php(338): Omeka_Record_AbstractRecord->save()
#9 /home/emhttest/public_html/emcms/application/models/Builder/Item.php(205): Item->saveFiles()
#10 /home/emhttest/public_html/emcms/application/libraries/globals.php(567): Builder_Item->addFiles()
#11 /home/emhttest/public_html/emcms/application/models/Item.php(323): insert_files_for_item()
#12 /home/emhttest/public_html/emcms/application/models/Item.php(233): Item->_uploadFiles()
#13 /home/emhttest/public_html/emcms/application/libraries/Omeka/Record/AbstractRecord.php(281): Item->beforeSave()
#14 /home/emhttest/public_html/emcms/application/libraries/Omeka/Record/AbstractRecord.php(530): Omeka_Record_AbstractRecord->runCallbacks()
#15 /home/emhttest/public_html/emcms/application/libraries/Omeka/Controller/AbstractActionController.php(236): Omeka_Record_AbstractRecord->save()
#16 /home/emhttest/public_html/emcms/application/controllers/ItemsController.php(88): Omeka_Controller_AbstractActionController->editAction()
#17 /home/emhttest/public_html/emcms/application/libraries/Zend/Controller/Action.php(516): ItemsController->editAction()
#18 /home/emhttest/public_html/emcms/application/libraries/Zend/Controller/Dispatcher/Standard.php(308): Zend_Controller_Action->dispatch()
#19 /home/emhttest/public_html/emcms/application/libraries/Zend/Controller/Front.php(954): Zend_Controller_Dispatcher_Standard->dispatch()
#20 /home/emhttest/public_html/emcms/application/libraries/Zend/Application/Bootstrap/Bootstrap.php(106): Zend_Controller_Front->dispatch()
#21 /home/emhttest/public_html/emcms/application/libraries/Zend/Application.php(384): Zend_Application_Bootstrap_Bootstrap->run()
#22 /home/emhttest/public_html/emcms/application/libraries/Omeka/Application.php(73): Zend_Application->run()
#23 /home/emhttest/public_html/emcms/admin/index.php(28): Omeka_Application->run()
#24 {main}

Initially it was happening only with large files (.mp3 and .pdf) but not image. Now it is happing in all the time.

The folders have pemissions set to 0755, so that should be sufficient? When it comes to diskspace I was close to the limit of my shared hosting account, but managed to free up a couple of gigabytes so that should not be a problem either.
I will try to move one of the Omeka sites to another hosting account to see if the problem persist there.

@atrevorsmith Your description of the problem originally being with large files and now happening even with smaller ones pretty strongly points toward you being out of disk space. Have you checked on that?

John,

Thanks for your suggestion, but we have ~6GB of disk available. Does Omeka have a partition that I might not know about? Is there a way of checking how much is allocated for Omeka other than cPanel statistics?:

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?