0

Hi i have created a custom module and added and i want to upload csv file as well inset data into custom table which is create through module.

System.xml

<?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">
<system>
    <tab id="vdcstore" translate="label" sortOrder="0">
        <label>Vdcstore</label>
    </tab>
    <section id="restrictzipcodes" sortOrder="0" showInWebsite="1" showInStore="1" showInDefault="1" translate="label">
        <label>Restrict Zip Codes</label>
        <tab>vdcstore</tab>
        <resource>Vdcstore_RestrictZip::config_vdcstore_restrictzip</resource>
        <group id="configuration" sortOrder="0" showInWebsite="1" showInStore="1" showInDefault="1" translate="label">
            <label>Configuration</label>
            <field id="enabled" type="select" sortOrder="1" showInWebsite="1" showInStore="1" showInDefault="1" translate="label">
                <label>Restrict Zip Codes</label>
                <comment/>
                <source_model>Magento\Config\Model\Config\Source\Enabledisable</source_model>
            </field>
            <field id="show_delivery_time" type="select" sortOrder="2" showInWebsite="1" showInStore="1" showInDefault="1" translate="label">
                <label>Show Estimated Delivery Time</label>
                <comment/>
                <source_model>Magento\Config\Model\Config\Source\Yesno</source_model>
            </field>
            <field id="checker_mag" type="text" sortOrder="3" showInWebsite="1" showInStore="1" showInDefault="1" translate="label">
                <label>Zip code Checker Message</label>
                <comment/>
            </field>
            <field id="delivery_availability_msg" type="text" sortOrder="4" showInWebsite="1" showInStore="1" showInDefault="1" translate="label">
                <label>Delivery Availability Message</label>
                <comment/>
            </field>
            <field id="delivery_unavailability_msg" type="text" sortOrder="5" showInWebsite="1" showInStore="1" showInDefault="1" translate="label">
                <label>Delivery Unavailability Message</label>
                <comment/>
            </field>
            <field id="delete_zip" type="select" sortOrder="6" showInWebsite="1" showInStore="1" showInDefault="1" translate="label">
                <label>Delete Existing Zip Codes</label>
                <comment>Save configuration immediately after selecting the option for this setting.</comment>
                <source_model>Magento\Config\Model\Config\Source\Yesno</source_model>
            </field>
            <field id="import_csv" type="Magento\Config\Block\System\Config\Form\Field\File" sortOrder="7" showInWebsite="1" showInStore="1" showInDefault="1" translate="label">
                <label>Import Zip Codes CSV</label>
                <backend_model>Vdcstore\RestrictZip\Model\Config\Backend\CustomFileType</backend_model>
                
                <upload_dir config="system" scope_info="1">Vdcstore/RestrictZip</upload_dir>
                <comment><![CDATA[Allowed file types: csv, xls]]></comment>
            </field>
        </group>
    </section>
</system>

enter image description here

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

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.