1 - create custom/Espo/Custom/Resourcs/metadata/app/fileStorage.json
PHP Code:
{
"implementationClassNameMap": {
"EspoUploadDir": "\\Espo\\Custom\\Core\\FileStorage\\Storages\\EspoUploadDir"
}
}
2 - create custom/Espo/Custom/Core/FileStrage/Storages/EspoUploadDir.php
PHP Code:
<?php
namespace Espo\Custom\Core\FileStorage\Storages;
use \Espo\Entities\Attachment;
use \Espo\Core\Exceptions\Error;
class EspoUploadDir extends Espo\Core\FileStorage\Storages\EspoUploadDir
{
protected function getFilePath(Attachment $attachment)
{
$sourceId = $attachment->getSourceId();
return 'crm/storageunit/' . $sourceId; // HERE YOUR CUSTOM PATH
}
}
I hope this helps

Leave a comment: