If creating the addon.xml file for cs-cart module and specifying an option with type=file
like that
<?xml version="1.0"?>
<addon scheme="3.0">
<id>my_addon</id>
<version>1.0</version>
<priority>4000</priority>
<status>active</status>
<auto_install>ULTIMATE,MULTIVENDOR</auto_install>
<default_language>en</default_language>
<dependencies/>
<settings edition_type="ROOT,ULT:VENDOR">
<sections>
<section id="general">
<items>
<item id="attach_file">
<type>file</type>
</item>
</items>
</section>
</sections>
</settings>
</addon>
Everything works perfectly on client side: file manager opens by clicking on "Browse..." button, and user can upload and select the file. But when the file in file manager is selected, only it's end filename is pasted into the module settings form field, so, it doesn't store the uploaded file location/path. Only it's filename. I have tried using
Registry::get('config.dir.files').Registry::get('addons.my_addon.attach_file');
To get the complete uploaded file path, but It doesn't work properly. It returns something like /path/to/site/root/var/files/my-file.pdf
instead of the real /path/to/site/root/var/files/1/my-file.pdf
(there is an extra 1
directory before the filename and I do not know how to represent it). If adding that extra 1
manually, then it may not work on different CS-Cart configurations.
So, how can I get the complete uploaded file path from the file manager in module settings popup from administration panel?