Can't upload files - Invalid target, must be a string

Hello,

Recently, i noticed that my dev environment has been broken; i can’t upload files there anymore.

The sql is working fine, i can modify items and everything, i tried setting the whole folder to 777 just to see, but to no avail.

Whenever i try to upload a file, wether or not i set a title tot he uploaded file, i get this error :
(some lines broken for readability)


Notice: tempnam(): file created in the system's temporary directory in
 /var/www/Limunata_litteraria/application/src/File/TempFile.php on line 132

Array ( [created] => 2022-11-10 01:24:45 [severity] => 3 [message] => Laminas\Filter\Exception\InvalidArgumentException: Invalid target, must be a string. in /var/www/Limunata_litteraria/vendor/laminas/laminas-filter/src/File/RenameUpload.php:82 Stack trace: #0 /var/www/Limunata_litteraria/vendor/laminas/laminas-filter/src/AbstractFilter.php(50): Laminas\Filter\File\RenameUpload->setTarget() #1 /var/www/Limunata_litteraria/vendor/laminas/laminas-filter/src/File/RenameUpload.php(50): Laminas\Filter\AbstractFilter->setOptions() #2 /var/www/Limunata_litteraria/application/src/File/Uploader.php(41): Laminas\Filter\File\RenameUpload->__construct() #3 /var/www/Limunata_litteraria/application/src/Media/Ingester/Upload.php(53): Omeka\File\Uploader->upload() #4 /var/www/Limunata_litteraria/application/src/Api/Adapter/MediaAdapter.php(164): Omeka\Media\Ingester\Upload->ingest() #5 /var/www/Limunata_litteraria/application/src/Api/Adapter/AbstractEntityAdapter.php(607): Omeka\Api\Adapter\MediaAdapter->hydrate() #6 /var/www/Limunata_litteraria/application/src/Api/Adapter/ItemAdapter.php(240): Omeka\Api\Adapter\AbstractEntityAdapter->hydrateEntity() #7 /var/www/Limunata_litteraria/application/src/Api/Adapter/AbstractEntityAdapter.php(607): Omeka\Api\Adapter\ItemAdapter->hydrate() #8 /var/www/Limunata_litteraria/application/src/Api/Adapter/AbstractEntityAdapter.php(417): Omeka\Api\Adapter\AbstractEntityAdapter->hydrateEntity() #9 /var/www/Limunata_litteraria/application/src/Api/Manager.php(233): Omeka\Api\Adapter\AbstractEntityAdapter->update() #10 /var/www/Limunata_litteraria/application/src/Api/Manager.php(136): Omeka\Api\Manager->execute() #11 /var/www/Limunata_litteraria/application/src/Mvc/Controller/Plugin/Api.php(152): Omeka\Api\Manager->update() #12 /var/www/Limunata_litteraria/application/src/Controller/Admin/ItemController.php(245): Omeka\Mvc\Controller\Plugin\Api->update() #13 /var/www/Limunata_litteraria/vendor/laminas/laminas-mvc/src/Controller/AbstractActionController.php(77): Omeka\Controller\Admin\ItemController->editAction() #14 /var/www/Limunata_litteraria/vendor/laminas/laminas-eventmanager/src/EventManager.php(321): Laminas\Mvc\Controller\AbstractActionController->onDispatch() #15 /var/www/Limunata_litteraria/vendor/laminas/laminas-eventmanager/src/EventManager.php(178): Laminas\EventManager\EventManager->triggerListeners() #16 /var/www/Limunata_litteraria/vendor/laminas/laminas-mvc/src/Controller/AbstractController.php(103): Laminas\EventManager\EventManager->triggerEventUntil() #17 /var/www/Limunata_litteraria/vendor/laminas/laminas-mvc/src/DispatchListener.php(139): Laminas\Mvc\Controller\AbstractController->dispatch() #18 /var/www/Limunata_litteraria/vendor/laminas/laminas-eventmanager/src/EventManager.php(321): Laminas\Mvc\DispatchListener->onDispatch() #19 /var/www/Limunata_litteraria/vendor/laminas/laminas-eventmanager/src/EventManager.php(178): Laminas\EventManager\EventManager->triggerListeners() #20 /var/www/Limunata_litteraria/vendor/laminas/laminas-mvc/src/Application.php(331): Laminas\EventManager\EventManager->triggerEventUntil() #21 /var/www/Limunata_litteraria/index.php(21): Laminas\Mvc\Application->run() #22 {main} [owner_id] => 4 [context] => [] ) 

and further down :

Laminas\Filter\Exception\InvalidArgumentException
Invalid target, must be a string.

Details :

Laminas\Filter\Exception\InvalidArgumentException: Invalid target, must be a string.
in /var/www/Limunata_litteraria/vendor/laminas/laminas-filter/src/File/RenameUpload.php:82

Stack trace:
#0 /var/www/Limunata_litteraria/vendor/laminas/laminas-filter/src/AbstractFilter.php(50): Laminas\Filter\File\RenameUpload->setTarget()
#1 /var/www/Limunata_litteraria/vendor/laminas/laminas-filter/src/File/RenameUpload.php(50): Laminas\Filter\AbstractFilter->setOptions()
#2 /var/www/Limunata_litteraria/application/src/File/Uploader.php(41): Laminas\Filter\File\RenameUpload->__construct()
#3 /var/www/Limunata_litteraria/application/src/Media/Ingester/Upload.php(53): Omeka\File\Uploader->upload()
#4 /var/www/Limunata_litteraria/application/src/Api/Adapter/MediaAdapter.php(164): Omeka\Media\Ingester\Upload->ingest()
#5 /var/www/Limunata_litteraria/application/src/Api/Adapter/AbstractEntityAdapter.php(607): Omeka\Api\Adapter\MediaAdapter->hydrate()
#6 /var/www/Limunata_litteraria/application/src/Api/Adapter/ItemAdapter.php(240): Omeka\Api\Adapter\AbstractEntityAdapter->hydrateEntity()
#7 /var/www/Limunata_litteraria/application/src/Api/Adapter/AbstractEntityAdapter.php(607): Omeka\Api\Adapter\ItemAdapter->hydrate()
#8 /var/www/Limunata_litteraria/application/src/Api/Adapter/AbstractEntityAdapter.php(417): Omeka\Api\Adapter\AbstractEntityAdapter->hydrateEntity()
#9 /var/www/Limunata_litteraria/application/src/Api/Manager.php(233): Omeka\Api\Adapter\AbstractEntityAdapter->update()
#10 /var/www/Limunata_litteraria/application/src/Api/Manager.php(136): Omeka\Api\Manager->execute()
#11 /var/www/Limunata_litteraria/application/src/Mvc/Controller/Plugin/Api.php(152): Omeka\Api\Manager->update()
#12 /var/www/Limunata_litteraria/application/src/Controller/Admin/ItemController.php(245): Omeka\Mvc\Controller\Plugin\Api->update()
#13 /var/www/Limunata_litteraria/vendor/laminas/laminas-mvc/src/Controller/AbstractActionController.php(77): Omeka\Controller\Admin\ItemController->editAction()
#14 /var/www/Limunata_litteraria/vendor/laminas/laminas-eventmanager/src/EventManager.php(321): Laminas\Mvc\Controller\AbstractActionController->onDispatch()
#15 /var/www/Limunata_litteraria/vendor/laminas/laminas-eventmanager/src/EventManager.php(178): Laminas\EventManager\EventManager->triggerListeners()
#16 /var/www/Limunata_litteraria/vendor/laminas/laminas-mvc/src/Controller/AbstractController.php(103): Laminas\EventManager\EventManager->triggerEventUntil()
#17 /var/www/Limunata_litteraria/vendor/laminas/laminas-mvc/src/DispatchListener.php(139): Laminas\Mvc\Controller\AbstractController->dispatch()
#18 /var/www/Limunata_litteraria/vendor/laminas/laminas-eventmanager/src/EventManager.php(321): Laminas\Mvc\DispatchListener->onDispatch()
#19 /var/www/Limunata_litteraria/vendor/laminas/laminas-eventmanager/src/EventManager.php(178): Laminas\EventManager\EventManager->triggerListeners()
#20 /var/www/Limunata_litteraria/vendor/laminas/laminas-mvc/src/Application.php(331): Laminas\EventManager\EventManager->triggerEventUntil()
#21 /var/www/Limunata_litteraria/index.php(21): Laminas\Mvc\Application->run()
#22 {main}

Is something broken at the php post that wouldn’t send the string for instance ? For the hell of it, i manually set the temp folder to somewhere else, and the files created inside of it weighed 0 bits.

This is kinda strange to me, as i don’t remember messing with omekas’ internal workings

If anyone has an idea…

Thanks

EDIT:
Trying to import a csv file instead gives me “Missing a temporary folder”; but testing sys_get_temp_dir() does returns me /tmp ; so i don’t think this is the actual problem

Trying to upload a file from url instead - i get this

Notice: tempnam(): file created in the system s temporary directory in 
/var/www/Limunata_litteraria/application/src/File/TempFile.php on line 132

Warning: finfo::file(): Empty filename or path in /var
/www/Limunata_litteraria/application/src/File/TempFile.php on line 302

Warning: array_key_exists(): The first argument should be either a string or an integer in 
/var/www/Limunata_litteraria/application/src/File/TempFile.php on line 303

Warning: unlink(): No such file or directory in 
/var/www/Limunata_litteraria/application/src/File/TempFile.php on line 383

Getting somewhere !

I also get this error

Validation error of "/files/whatever/a_baretta_misgia_1925_ghiugnu.jpg". 
Impossible to handle files with media type "".

Is it that the name doesn’t get uploaded ? And so like the temp file created has no extension or something like this

EDIT :
Reading the POST call

How can i continue to debug from here ?

The tempnam call that creates the first notice: that tries to create a file in your configured Omeka S temporary directory (this is the system temp folder if not configured, but you can set temp_dir in your local.config.php file to set it somewhere else).

That notice only happens when PHP couldn’t make a temporary file in the directory we asked for and instead did so in the system folder.

Do you have temp_dir configured to something custom in your config file?

in my local.config.php, i see no temp_dir key… should i set it manually ?

You don’t typically need to set it, but you can set it manually to see if that affects what’s happening.

Whatever folder you set it to needs to be writable by the server.

If you’re just having this problem without having that temp_dir setting set, it’s possible that the default PHP system temporary directory (usually this is /tmp but it could be something else) is just not writable by the server.

maybe i have some certificate problems coming in the middle… Thanks for your help, i’ll update this if i fix it somehow