zend file transfer exception

When trying to upload my first document to Omeka, I get a file transfer exception with the following info. I'm wondering if this is related to the fact that a) I installed Omeka on a subdirectory of my main site, which uses Wordpress (i.e. mydomain.net/omeka) or perhaps b) that I got a warning that I don't have a "fileinfo" module loaded into PHP. Not sure where to go from here.

exception 'Zend_File_Transfer_Exception' with message 'The given destination is not a directory or does not exist' in /home/content/g/w/i/gwijthoff/html/gadgetry/application/libraries/Zend/File/Transfer/Adapter/Abstract.php:1035
Stack trace:
#0 /home/content/g/w/i/gwijthoff/html/gadgetry/application/libraries/Omeka/File/Ingest/Upload.php(41): Zend_File_Transfer_Adapter_Abstract->setDestination('/var/chroot/hom...')
#1 /home/content/g/w/i/gwijthoff/html/gadgetry/application/libraries/Omeka/File/Ingest/Upload.php(113): Omeka_File_Ingest_Upload->_buildAdapter()
#2 /home/content/g/w/i/gwijthoff/html/gadgetry/application/libraries/Omeka/File/Ingest/Abstract.php(181): Omeka_File_Ingest_Upload->_parseFileInfo('file')
#3 /home/content/g/w/i/gwijthoff/html/gadgetry/application/models/ItemBuilder.php(210): Omeka_File_Ingest_Abstract->ingest('file')
#4 /home/content/g/w/i/gwijthoff/html/gadgetry/application/libraries/globals.php(491): ItemBuilder->addFiles('Upload', 'file', Array)
#5 /home/content/g/w/i/gwijthoff/html/gadgetry/application/models/Item.php(270): insert_files_for_item(Object(Item), 'Upload', 'file', Array)
#6 /home/content/g/w/i/gwijthoff/html/gadgetry/application/models/Item.php(154): Item->_uploadFiles()
#7 [internal function]: Item->beforeSaveForm(Object(ArrayObject))
#8 /home/content/g/w/i/gwijthoff/html/gadgetry/application/libraries/Omeka/Record.php(284): call_user_func_array(Array, Array)
#9 /home/content/g/w/i/gwijthoff/html/gadgetry/application/libraries/Omeka/Record.php(805): Omeka_Record->runCallbacks('beforeSaveForm', Object(ArrayObject))
#10 /home/content/g/w/i/gwijthoff/html/gadgetry/application/libraries/Omeka/Controller/Action.php(420): Omeka_Record->saveForm(Array)
#11 /home/content/g/w/i/gwijthoff/html/gadgetry/application/controllers/ItemsController.php(134): Omeka_Controller_Action->addAction()
#12 /home/content/g/w/i/gwijthoff/html/gadgetry/application/libraries/Zend/Controller/Action.php(513): ItemsController->addAction()
#13 /home/content/g/w/i/gwijthoff/html/gadgetry/application/libraries/Zend/Controller/Dispatcher/Standard.php(295): Zend_Controller_Action->dispatch('addAction')
#14 /home/content/g/w/i/gwijthoff/html/gadgetry/application/libraries/Zend/Controller/Front.php(954): Zend_Controller_Dispatcher_Standard->dispatch(Object(Zend_Controller_Request_Http), Object(Zend_Controller_Response_Http))
#15 /home/content/g/w/i/gwijthoff/html/gadgetry/application/libraries/Zend/Application/Bootstrap/Bootstrap.php(97): Zend_Controller_Front->dispatch()
#16 /home/content/g/w/i/gwijthoff/html/gadgetry/application/libraries/Zend/Application.php(366): Zend_Application_Bootstrap_Bootstrap->run()
#17 /home/content/g/w/i/gwijthoff/html/gadgetry/application/libraries/Omeka/Core.php(166): Zend_Application->run()
#18 /home/content/g/w/i/gwijthoff/html/gadgetry/admin/index.php(45): Omeka_Core->run()
#19 {main}

Your system appears to be telling Omeka to use a temporary directory that doesn't exist (you can't see the whole thing in the stack trace, but the path starts with "/var/chroot/hom...").

I'm not sure what the underlying problem is, but you should be able to avoid this by adding a setting in Omeka's application/config/config.ini:

storage.tempDir = "/some/path"

Where "/some/path" is a path to a directory Omeka can write to and use for temporary storage of files.

Having the same issue.

Fixed it in config.ini by adding storage.tempDir = "/tmp"

However, this just gave way to another error.

Omeka_Storage_Exception
The storage adapter is not initialized.
#0 /home/content/e/b/e/ebellempire/html/omeka-sandbox/application/models/File.php(129): Omeka_Storage->__call('getUri', Array)
#1 /home/content/e/b/e/ebellempire/html/omeka-sandbox/application/models/File.php(129): Omeka_Storage->getUri('files/dd3fe4985...')
#2 /home/content/e/b/e/ebellempire/html/omeka-sandbox/application/helpers/Media.php(504): File->getWebPath('archive')
#3 [internal function]: Omeka_View_Helper_Media->mov(Object(File), Array)
#4 /home/content/e/b/e/ebellempire/html/omeka-sandbox/application/helpers/Media.php(727): call_user_func_array(Array, Array)
#5 /home/content/e/b/e/ebellempire/html/omeka-sandbox/application/helpers/Media.php(752): Omeka_View_Helper_Media->getHtml(Object(File), 'mov', Array)
#6 /home/content/e/b/e/ebellempire/html/omeka-sandbox/application/helpers/FileFunctions.php(45): Omeka_View_Helper_Media->media(Object(File), Array, Array)
#7 /home/content/e/b/e/ebellempire/html/omeka-sandbox/application/helpers/ItemFunctions.php(42): display_files(Array, Array, Array)
#8 /home/content/e/b/e/ebellempire/html/omeka-sandbox/admin/themes/default/items/show.php(42): display_files_for_item(Array)
#9 /home/content/e/b/e/ebellempire/html/omeka-sandbox/application/libraries/Omeka/View.php(113): include('/home/content/e...')
#10 /home/content/e/b/e/ebellempire/html/omeka-sandbox/application/libraries/Zend/View/Abstract.php(888): Omeka_View->_run('/home/content/e...')
#11 /home/content/e/b/e/ebellempire/html/omeka-sandbox/application/libraries/Zend/Controller/Action/Helper/ViewRenderer.php(900): Zend_View_Abstract->render('items/show.php')
#12 /home/content/e/b/e/ebellempire/html/omeka-sandbox/application/libraries/Zend/Controller/Action/Helper/ViewRenderer.php(921): Zend_Controller_Action_Helper_ViewRenderer->renderScript('items/show.php', NULL)
#13 /home/content/e/b/e/ebellempire/html/omeka-sandbox/application/libraries/Zend/Controller/Action/Helper/ViewRenderer.php(960): Zend_Controller_Action_Helper_ViewRenderer->render()
#14 /home/content/e/b/e/ebellempire/html/omeka-sandbox/application/libraries/Zend/Controller/Action/HelperBroker.php(277): Zend_Controller_Action_Helper_ViewRenderer->postDispatch()
#15 /home/content/e/b/e/ebellempire/html/omeka-sandbox/application/libraries/Zend/Controller/Action.php(527): Zend_Controller_Action_HelperBroker->notifyPostDispatch()
#16 /home/content/e/b/e/ebellempire/html/omeka-sandbox/application/libraries/Zend/Controller/Dispatcher/Standard.php(295): Zend_Controller_Action->dispatch('showAction')
#17 /home/content/e/b/e/ebellempire/html/omeka-sandbox/application/libraries/Zend/Controller/Front.php(954): Zend_Controller_Dispatcher_Standard->dispatch(Object(Zend_Controller_Request_Http), Object(Zend_Controller_Response_Http))
#18 /home/content/e/b/e/ebellempire/html/omeka-sandbox/application/libraries/Zend/Application/Bootstrap/Bootstrap.php(97): Zend_Controller_Front->dispatch()
#19 /home/content/e/b/e/ebellempire/html/omeka-sandbox/application/libraries/Zend/Application.php(366): Zend_Application_Bootstrap_Bootstrap->run()
#20 /home/content/e/b/e/ebellempire/html/omeka-sandbox/application/libraries/Omeka/Core.php(165): Zend_Application->run()
#21 /home/content/e/b/e/ebellempire/html/omeka-sandbox/admin/index.php(44): Omeka_Core->run()
#22 {main}

Hmm...

It must be that the option for the "default" adapter doesn't get used if you specify any other storage options.

Adding

storage.adapter = "Omeka_Storage_Adapter_Filesystem"

should fix that.

Perfect. Thanks.

Hi, I received a similar error when attempting to upload my first file. I tried everything suggested above but to no avail. I know where to put code but I dont know what it means. But if you can help that would be great. Thanks.

#0 /usr/local/pem/vhosts/123068/webspace/httpdocs/granule/tweedyarchive/application/libraries/Omeka/File/Ingest/Upload.php(40): Zend_File_Transfer_Adapter_Abstract->setDestination('/archive/tmp')
#1 /usr/local/pem/vhosts/123068/webspace/httpdocs/granule/tweedyarchive/application/libraries/Omeka/File/Ingest/Upload.php(112): Omeka_File_Ingest_Upload->_buildAdapter()
#2 /usr/local/pem/vhosts/123068/webspace/httpdocs/granule/tweedyarchive/application/libraries/Omeka/File/Ingest/Abstract.php(165): Omeka_File_Ingest_Upload->_parseFileInfo('file')
#3 /usr/local/pem/vhosts/123068/webspace/httpdocs/granule/tweedyarchive/application/models/ItemBuilder.php(209): Omeka_File_Ingest_Abstract->ingest('file')
#4 /usr/local/pem/vhosts/123068/webspace/httpdocs/granule/tweedyarchive/application/libraries/globals.php(505): ItemBuilder->addFiles('Upload', 'file', Array)
#5 /usr/local/pem/vhosts/123068/webspace/httpdocs/granule/tweedyarchive/application/models/Item.php(286): insert_files_for_item(Object(Item), 'Upload', 'file', Array)
#6 /usr/local/pem/vhosts/123068/webspace/httpdocs/granule/tweedyarchive/application/models/Item.php(153): Item->_uploadFiles()
#7 [internal function]: Item->beforeSaveForm(Object(ArrayObject))
#8 /usr/local/pem/vhosts/123068/webspace/httpdocs/granule/tweedyarchive/application/libraries/Omeka/Record.php(282): call_user_func_array(Array, Array)
#9 /usr/local/pem/vhosts/123068/webspace/httpdocs/granule/tweedyarchive/application/libraries/Omeka/Record.php(803): Omeka_Record->runCallbacks('beforeSaveForm', Object(ArrayObject))
#10 /usr/local/pem/vhosts/123068/webspace/httpdocs/granule/tweedyarchive/application/libraries/Omeka/Controller/Action.php(419): Omeka_Record->saveForm(Array)
#11 /usr/local/pem/vhosts/123068/webspace/httpdocs/granule/tweedyarchive/application/controllers/ItemsController.php(133): Omeka_Controller_Action->addAction()
#12 /usr/local/pem/vhosts/123068/webspace/httpdocs/granule/tweedyarchive/application/libraries/Zend/Controller/Action.php(516): ItemsController->addAction()
#13 /usr/local/pem/vhosts/123068/webspace/httpdocs/granule/tweedyarchive/application/libraries/Zend/Controller/Dispatcher/Standard.php(295): Zend_Controller_Action->dispatch('addAction')
#14 /usr/local/pem/vhosts/123068/webspace/httpdocs/granule/tweedyarchive/application/libraries/Zend/Controller/Front.php(954): Zend_Controller_Dispatcher_Standard->dispatch(Object(Zend_Controller_Request_Http), Object(Zend_Controller_Response_Http))
#15 /usr/local/pem/vhosts/123068/webspace/httpdocs/granule/tweedyarchive/application/libraries/Zend/Application/Bootstrap/Bootstrap.php(97): Zend_Controller_Front->dispatch()
#16 /usr/local/pem/vhosts/123068/webspace/httpdocs/granule/tweedyarchive/application/libraries/Zend/Application.php(366): Zend_Application_Bootstrap_Bootstrap->run()
#17 /usr/local/pem/vhosts/123068/webspace/httpdocs/granule/tweedyarchive/application/libraries/Omeka/Core.php(165): Zend_Application->run()
#18 /usr/local/pem/vhosts/123068/webspace/httpdocs/granule/tweedyarchive/admin/index.php(44): Omeka_Core->run()
#19 {main}

Can you include a few more lines from that error output? The lines at the very top are the ones that give the exception name and error message. These are the parts that really describe the error.

Sorry, yes:
Zend_File_Transfer_Exception
The given destination is not a directory or does not exist

Maybe Im setting the directory path incorrectly? I wasnt sure if the path was relative to the config file so I also tried ../../archive/tmp and a few others in case, but always with the same result.

I'd try creating your "temp" dir somewhere within your webspace, then giving the storage.tempDir setting as the absolute path to the directory.

That means, the path has to be from the filesystem root, not the Omeka root. Judging by your error output, it should start like: /usr/local/pem/vhosts/123086/. You can use pwd on the command line to get the absolute path to your current directory (or readlink -f [path] to get an absolute path from a relative one).

If possible, you'd want to pick a location that's accessible to you and your scripts, but not served to the web.

Hi, thanks for your help. It seemed to work, after I uploaded an image it appeared in the tmp folder I specified.
However, now there is another problem with locating the imagemagick path. I was in touch with my hosting provider (Blacknight) and they suggested that I setup the webspace to use CGI mode rather than Apache mode for PHP. Is this necessary?
Here is the error when I try to set the imagemagick path on the settings panel on the omeka admin page.

Fails
Warning: realpath(): open_basedir restriction in effect. File(/usr/bin) is not within the allowed path(s): (/php/includes/:/usr/local/pem/vhosts/123068/) in /usr/local/pem/vhosts/123068/webspace/httpdocs/granule/tweedyarchive/application/controllers/SettingsController.php on line 82

Despite the above error I attempted to upload an image anyway and this is the error returned:

Omeka_File_Derivative_Exception
ImageMagick is not properly configured: invalid directory given for the ImageMagick command!

#0 /usr/local/pem/vhosts/123068/webspace/httpdocs/granule/tweedyarchive/application/libraries/Omeka/File/Derivative/Image.php(149): Omeka_File_Derivative_Image::_getPathToImageMagick()
#1 /usr/local/pem/vhosts/123068/webspace/httpdocs/granule/tweedyarchive/application/libraries/Omeka/File/Derivative/Image.php(113): Omeka_File_Derivative_Image::createImage('/usr/local/pem/...', '800', 'fullsize')
#2 /usr/local/pem/vhosts/123068/webspace/httpdocs/granule/tweedyarchive/application/libraries/Omeka/File/Derivative/Image.php(222): Omeka_File_Derivative_Image::createDerivativeImages('/usr/local/pem/...')
#3 /usr/local/pem/vhosts/123068/webspace/httpdocs/granule/tweedyarchive/application/models/File.php(248): Omeka_File_Derivative_Image::createAll('/usr/local/pem/...', 'image/png')
#4 /usr/local/pem/vhosts/123068/webspace/httpdocs/granule/tweedyarchive/application/models/File/ProcessUploadJob.php(24): File->createDerivatives()
#5 /usr/local/pem/vhosts/123068/webspace/httpdocs/granule/tweedyarchive/application/libraries/Omeka/Job/Dispatcher/Adapter/Synchronous.php(25): File_ProcessUploadJob->perform()
#6 /usr/local/pem/vhosts/123068/webspace/httpdocs/granule/tweedyarchive/application/libraries/Omeka/Job/Dispatcher/Default.php(95): Omeka_Job_Dispatcher_Adapter_Synchronous->send('{"className":"F...', Array)
#7 /usr/local/pem/vhosts/123068/webspace/httpdocs/granule/tweedyarchive/application/models/File.php(70): Omeka_Job_Dispatcher_Default->send('File_ProcessUpl...', Array)
#8 [internal function]: File->afterInsert()
#9 /usr/local/pem/vhosts/123068/webspace/httpdocs/granule/tweedyarchive/application/libraries/Omeka/Record.php(282): call_user_func_array(Array, Array)
#10 /usr/local/pem/vhosts/123068/webspace/httpdocs/granule/tweedyarchive/application/libraries/Omeka/Record.php(561): Omeka_Record->runCallbacks('afterInsert')
#11 /usr/local/pem/vhosts/123068/webspace/httpdocs/granule/tweedyarchive/application/libraries/Omeka/Record.php(581): Omeka_Record->save()
#12 /usr/local/pem/vhosts/123068/webspace/httpdocs/granule/tweedyarchive/application/models/Item.php(303): Omeka_Record->forceSave()
#13 /usr/local/pem/vhosts/123068/webspace/httpdocs/granule/tweedyarchive/application/models/ItemBuilder.php(213): Item->saveFiles()
#14 /usr/local/pem/vhosts/123068/webspace/httpdocs/granule/tweedyarchive/application/libraries/globals.php(505): ItemBuilder->addFiles('Upload', 'file', Array)
#15 /usr/local/pem/vhosts/123068/webspace/httpdocs/granule/tweedyarchive/application/models/Item.php(286): insert_files_for_item(Object(Item), 'Upload', 'file', Array)
#16 /usr/local/pem/vhosts/123068/webspace/httpdocs/granule/tweedyarchive/application/models/Item.php(153): Item->_uploadFiles()
#17 [internal function]: Item->beforeSaveForm(Object(ArrayObject))
#18 /usr/local/pem/vhosts/123068/webspace/httpdocs/granule/tweedyarchive/application/libraries/Omeka/Record.php(282): call_user_func_array(Array, Array)
#19 /usr/local/pem/vhosts/123068/webspace/httpdocs/granule/tweedyarchive/application/libraries/Omeka/Record.php(803): Omeka_Record->runCallbacks('beforeSaveForm', Object(ArrayObject))
#20 /usr/local/pem/vhosts/123068/webspace/httpdocs/granule/tweedyarchive/application/libraries/Omeka/Controller/Action.php(482): Omeka_Record->saveForm(Array)
#21 /usr/local/pem/vhosts/123068/webspace/httpdocs/granule/tweedyarchive/application/controllers/ItemsController.php(99): Omeka_Controller_Action->editAction()
#22 /usr/local/pem/vhosts/123068/webspace/httpdocs/granule/tweedyarchive/application/libraries/Zend/Controller/Action.php(516): ItemsController->editAction()
#23 /usr/local/pem/vhosts/123068/webspace/httpdocs/granule/tweedyarchive/application/libraries/Zend/Controller/Dispatcher/Standard.php(295): Zend_Controller_Action->dispatch('editAction')
#24 /usr/local/pem/vhosts/123068/webspace/httpdocs/granule/tweedyarchive/application/libraries/Zend/Controller/Front.php(954): Zend_Controller_Dispatcher_Standard->dispatch(Object(Zend_Controller_Request_Http), Object(Zend_Controller_Response_Http))
#25 /usr/local/pem/vhosts/123068/webspace/httpdocs/granule/tweedyarchive/application/libraries/Zend/Application/Bootstrap/Bootstrap.php(97): Zend_Controller_Front->dispatch()
#26 /usr/local/pem/vhosts/123068/webspace/httpdocs/granule/tweedyarchive/application/libraries/Zend/Application.php(366): Zend_Application_Bootstrap_Bootstrap->run()
#27 /usr/local/pem/vhosts/123068/webspace/httpdocs/granule/tweedyarchive/application/libraries/Omeka/Core.php(165): Zend_Application->run()
#28 /usr/local/pem/vhosts/123068/webspace/httpdocs/granule/tweedyarchive/admin/index.php(44): Omeka_Core->run()
#29 {main}

Is there a way to fix this without reconfiguring my host server? Thanks for your assistance.

This is coming from the same root problem as the issue that made you pick a different temporary directory: your web host has set a restrictive open_basedir setting for PHP that doesn't allow you to access many directories on the server.

Specifically, the problem here is that we call realpath and is_dir on the ImageMagick directory you give us, to make sure its a valid path. If the open_basedir restriction doesn't allow access to that directory, Omeka sees that as an invalid path.

You might be able to move forward by removing those checks from the code, but the better option is probably just to see if your host will relax or disable the open_basedir restrictions for your site.

Thanks for the help. What worked in the end is setting up the site on a webspace on my host server (Blacknight Solutions) using CGI mode rather than Apache for PHP. Or something. Anyway it works.

Hello, I installed Omeka 2.0.2 last week and I'm getting errors when trying to change the Theme, or adding an item to my collection.

After enabling error logging I discovered that I always got the same message:
2013-04-23T10:17:35+02:00 ERR (3): exception 'Zend_File_Transfer_Exception' with message 'The given destination is not a directory or does not exist' in /usr/home/catalegmuseuarta.com/web/omeka/application/libraries/Zend/File/Transfer/Adapter/Abstract.php:1035

I've tried to add storage.tempDir = "/tmp" in the config.ini file but it hasn't solved the problem and I'm not sure what to do next.

Besides, today I've tried to add a new item and I've got an error message but checking the errors.log file I've discovered that isn't updating anymore, so now I have no chance to know which errors I'm getting.

I might use some help, as you can see.

Thank you!