BoldMinded acquires Ansel, support ending for all add-ons. BoldMinded acquires Ansel, support ending for all add-ons. Read More →
Support has been discontinued. Issues remain available as an archive. Support has been discontinued. Issues remain available as an archive.
Can't create a temp file from path
#228 opened by Matt V
Description
Based on the above setup, I did the following to test:
- Created a new entry to test a file upload. It uploaded properly. And the entry saved properly.
- Created a new entry to test an Ansel upload. It appeared to upload properly and a thumbnail appeared in the entry as you would expect. But when I try to save the entry, I get an error message.
This is the error and subsequent stack trace (I've anonymized it slightly):
Exception Caught
Cannot create a temp file from path: chroot/home/sitedir/siteurl.com/html/images/uploads/test-ansel-source/testfilename.png
ee/ExpressionEngine/Library/Filesystem/Filesystem.php:990
Stack Trace: _Please include when reporting this error_
- #0 ee/legacy/libraries/Filemanager.php(1151): ExpressionEngine\Library\Filesystem\Filesystem->copyToTempFile('chroot/home/sit...')
- #1 user/addons/ansel/Service/Sources/Ee.php(385): Filemanager->create_thumb('/home/sitedir/...', Array, true, false)
- #2 [internal function]: BuzzingPixel\Ansel\Service\Sources\Ee->addFile('8', '...')
- #3 user/addons/ansel/Service/Sources/SourceRouter.php(84): call_user_func_array(Array, Array)
- #4 user/addons/ansel/Service/AnselImages/SaveRow.php(127): BuzzingPixel\Ansel\Service\Sources\SourceRouter->__call('addFile', Array)
- #5 user/addons/ansel/Controller/Field/FieldSave.php(95): BuzzingPixel\Ansel\Service\AnselImages\SaveRow->save(Array, Object(BuzzingPixel\Ansel\Model\FieldSettings), '4', '15', NULL, NULL)
- #6 user/addons/ansel/ft.ansel.php(575): BuzzingPixel\Ansel\Controller\Field\FieldSave->save(Array, '4', '15', NULL, NULL)
- #7 ee/legacy/libraries/api/Api_channel_fields.php(383): Ansel_ft->post_save(Array)
- #8 ee/ExpressionEngine/Model/Content/FieldFacade.php(240): Api_channel_fields->apply('post_save', Array)
- #9 ee/ExpressionEngine/Model/Content/ContentModel.php(74): ExpressionEngine\Model\Content\FieldFacade->postSave()
- #10 ee/ExpressionEngine/Model/Channel/ChannelEntry.php(438): ExpressionEngine\Model\Content\ContentModel->onAfterSave()
- #11 [internal function]: ExpressionEngine\Model\Channel\ChannelEntry->onAfterSave()
- #12 ee/ExpressionEngine/Service/Model/Model.php(840): call_user_func_array(Array, Array)
- #13 ee/ExpressionEngine/Service/Model/Query/Insert.php(31): ExpressionEngine\Service\Model\Model->emit('afterSave')
- #14 ee/ExpressionEngine/Service/Model/DataStore.php(275): ExpressionEngine\Service\Model\Query\Insert->run()
- #15 ee/ExpressionEngine/Service/Model/DataStore.php(230): ExpressionEngine\Service\Model\DataStore->runQuery('Insert', Object(ExpressionEngine\Service\Model\Query\Builder))
- #16 ee/ExpressionEngine/Service/Model/Query/Builder.php(80): ExpressionEngine\Service\Model\DataStore->insertQuery(Object(ExpressionEngine\Service\Model\Query\Builder))
- #17 ee/ExpressionEngine/Service/Model/Model.php(362): ExpressionEngine\Service\Model\Query\Builder->insert()
- #18 ee/ExpressionEngine/Model/Content/ContentModel.php(219): ExpressionEngine\Service\Model\Model->save()
- #19 ee/ExpressionEngine/Controller/Publish/AbstractPublish.php(443): ExpressionEngine\Model\Content\ContentModel->save()
- #20 ee/ExpressionEngine/Controller/Publish/Publish.php(304): ExpressionEngine\Controller\Publish\AbstractPublish->saveEntryAndRedirect(Object(ExpressionEngine\Addons\Pro\Model\Channel\ChannelEntry))
- #21 [internal function]: ExpressionEngine\Controller\Publish\Publish->create(4)
- #22 ee/ExpressionEngine/Core/Core.php(268): call_user_func_array(Array, Array)
- #23 ee/ExpressionEngine/Core/Core.php(124): ExpressionEngine\Core\Core->runController(Array)
- #24 ee/ExpressionEngine/Boot/boot.php(184): ExpressionEngine\Core\Core->run(Object(ExpressionEngine\Core\Request))
- #25 admin.php(139): require_once('...')
- #25 admin.php(139): require_once('...')
I've reviewed the file system permissions. The appropriate directories are set to 775.
I'm a little stumped, and I'd love your help.
Replies
- TJ Draper
Replied 5/17/2023 7:38 AM, Edited 5/17/2023 7:39 AM
That’s very odd. I haven’t ever had something like that unless there was a permissions issue.
I’d be curious to known a couple of things:
- If you’re able to upload to that directory natively through EE’s file upload interface?
- If changing the permission to
0777
fixes it?
If 1 is true, I’d be extremely baffled. If 1 AND 2 are true, I’m still a little baffled, but it still could be related, somehow, to the option below, which is:
If 2 is true (and not 1), I think it likely there’s a file ownership issue where the user that owns the directory is different than the user running the webserver and/or PHP.
- Matt V
Replied 5/17/2023 8:26 AM, Edited 5/17/2023 8:28 AM
Thanks for the response, TJ.
I agree that this is super weird. The site I'm trying to upgrade is an EE3 site that has used Ansel just fine for years. And it's on the same server. I noticed this on the EE7-upgraded staging site and figured it might be something weird about the upgrade. But when it also happened on a clean install, I figured it was time to reach out to you.
In answer to your questions:
- Yes, I can upload successfully through a native file field.
- Changing the permission to 0777 does not fix it.
2a. The owner of the directories is the account owner, which is the same as all of the rest of the directories in the install and on the server.
The file does get uploaded to the source directory. And a thumbnail is created there. But nothing makes it to the target directory.
So yeah, I'm baffled, too.
It's a legacy server at Nexcess. I've given you PHP and MariaDB versions, but if there's something else I can provide you from the PHP Info or whatever, I'm happy to help. If it would be useful to have FTP/Admin access, I can arrange for that, too. (I'll need an IP from you for FTP access.)
For what it's worth, it works fine on a different server I was using as a dev server.
- Paul Vance
Replied 1/9/2024 11:24 AM
Was this ever resolved? I seem to be having the same issue.