0

Here is the content of the system.xml file:

<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:module:Magento_Config:etc/system_file.xsd">
 <system>
 <section id="develodesign_productpagerendermsg" showInDefault="1" showInStore="1" showInWebsite="1" sortOrder="10" translate="label">
 <label><![CDATA[Product Page Stock Location]]></label>
 <tab>catalog</tab>
 <resource>Develodesign_General::general</resource>
 <group id="company_flag" translate="label" type="text" sortOrder="6" showInDefault="1" showInWebsite="1">
 <label>Company Display Settings</label>
 <field id="custom_message" translate="label" type="Magento\Config\Block\System\Config\Form\Field\File" sortOrder="1" showInDefault="1" showInWebsite="1" >
 <label>Identifier, SKU and Custom Message CSV Mapper</label>
 <backend_model>Develodesign\General\Model\Config\Backend\FileUploader</backend_model>
 <upload_dir config="system/filesystem/media" scope_info="1">catalog/custom_message</upload_dir>
 <comment>CSV Header must be set to Company Id, Product SKU, and Custom Message.</comment>
 </field>
 <field id="employee_mapper" translate="label" type="Magento\Config\Block\System\Config\Form\Field\File" sortOrder="3" showInDefault="1" showInWebsite="1" >
 <label>Employee Name, Sole Code and Boot Code CSV Mapper</label>
 <backend_model>Develodesign\General\Model\Config\Backend\FileUploader</backend_model>
 <upload_dir config="system/filesystem/media" scope_info="1">catalog/company_employee</upload_dir>
 <comment>CSV Header must be set to Employee Name,Sole Code and Boot Code. Allowed file types: csv, xls,text/csv</comment>
 </field>
 <field id="product_sku" translate="label" type="text" sortOrder="2" showInDefault="1" showInWebsite="1" showInStore="4">
 <label>Product SKU</label>
 <validate>required-entry</validate>
 </field>
 </group>
 </section>
 </system>
</config>

I am using a custom class ....\General\Model\Config\Backend\FileUploader that extends magento Magento\Config\Model\Config\Backend\File Here is the file input greyed out in the admin frontendgreyed out file upload input. Inspecting the element I can see a class 'disabled' being added to the input, removing this class sure fixes the issue, of course, I can add a js file to remove the attribute on document ready, however, I am more interested in why its disabled in the first place.

asked Nov 3, 2020 at 10:32

2 Answers 2

0

The backend model has to changed to below for files

\Magento\Config\Model\Config\Backend\File

For images the backend model should be

Magento\Config\Model\Config\Backend\Image

And for PDFs

Magento\Config\Model\Config\Backend\Image\Pdf

answered Nov 3, 2020 at 12:48
1
  • I am using a custom class Develodesign\General\Model\Config\Backend than extends the Magento\Config\Model\Config\Backend\File Commented Nov 3, 2020 at 15:05
0

If anyone sees this and had a similar issue, it was caused by the configuration value being locked with --lock-env on that environment

answered May 17, 2023 at 13:05

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.