Hi i have created a custom module and added a custom file upload link

Here is the output image

enter image description here


<?xml version="1.0"?>
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:module:Magento_Config:etc/system_file.xsd">
        <tab id="test" translate="label" sortOrder="200">
        <section id="zipcode" translate="label" type="text" sortOrder="120" showInDefault="1" showInWebsite="1" showInStore="1">
            <group id="config" translate="label" type="text" sortOrder="10" showInDefault="1" showInWebsite="0" showInStore="0">
                <label>Check delivery postcode</label>
                <field id="enable" translate="label" type="select" sortOrder="1" showInDefault="1" showInWebsite="1" showInStore="1">
                <field id="postcodes" translate="label" type="textarea" sortOrder="20" showInDefault="1" showInWebsite="1" showInStore="1">
                    <depends><field id="enable">1</field></depends>

                <!-- csv file upload starts here -->
                <field id="custom_file_upload" translate="label" type="Magento\Config\Block\System\Config\Form\Field\File" sortOrder="30" showInDefault="1" showInWebsite="1" >
                 <label>Upload Csv File</label>
                <!-- file upload ends here -->

                <field id="success_message" translate="label" type="text" sortOrder="21" showInDefault="1" showInWebsite="1" showInStore="1">
                    <label>Success message</label>
                    <depends><field id="enable">1</field></depends>
                <field id="error_message" translate="label" type="text" sortOrder="22" showInDefault="1" showInWebsite="1" showInStore="1">
                    <label>Error message</label>
                    <depends><field id="enable">1</field></depends>


Now i want to upload csv file of zipcodes but am not totaly sure how to upload it can anyone please help me

  • if my answer was helpful, please accept my answer by clicking on the right sign below score of my answer. Commented Feb 4, 2020 at 12:02

1 Answer 1


It would be the easiest if you add a custom backend model (for example Vendor\Module\Model\Config\Backend\Zipcode) to the config field in the system.xml file. Then use the afterSave() to save whatever you want.

Note: Your backend model class should extend \Magento\Framework\App\Config\Value class.

You can have a look at the following files for reference:

  • /vendor/magento/module-offline-shipping/Model/Config/Backend/Tablerate.php
  • /vendor/magento/module-offline-shipping/etc/adminhtml/system.xml

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.