1

Here's my system.xml field definition:

<fields>
    <upload translate="label">
        <label>Upload Latest</label>
        <comment><![CDATA[This file gives you a more up-to-date BIN database. Please upload one regularly to stay ahead.]]></comment>
        <frontend_type>file</frontend_type>
        <backend_model>adminhtml/system_config_backend_file</backend_model>
        <upload_dir>var/uploads</upload_dir>
        <sort_order>50</sort_order>
        <show_in_default>1</show_in_default>
        <show_in_website>0</show_in_website>
        <show_in_store>0</show_in_store>
    </upload>
</fields>

The field shows successfully, but for some reason, when I browse for a file and click Save Config, it just redirects me to the Dashboard, there's no communication with any models, it literally just loads the dashboard.

How can I debug this issue successfully?

Update
After some additional digging, it appears to accept some files.

The particular file I'm looking to upload is a CSV that is 11.9 Mb. I've tried a small Jpg and it uploads successfully.

Could be to do with Filesize or File Type. How do I specifically enable CSV and increase the File Size limit to 20Mb?

3

It would be very good to tell magento to allow upload only files with csv type.

In your extension create

class Namespace_Module_Model_System_Config_Backend_Csv extends Mage_Adminhtml_Model_System_Config_Backend_File
{
    protected function _getAllowedExtensions()
    {
        return array('csv');
    }
}

Now in system.xml

<backend_model>namespace_module/system_config_backend_csv</backend_model>

And of course in php.ini increase post_max_size value.

post_max_size = 20M
  • it was the post_max_size that was causing it to drop out to the dashboard. Thanks for this; I've also taken your advice and added csv to the _getAllowedExtensions method. – Dan Hanly Mar 13 '14 at 11:11
1

This is not a problem in magento.

Need to set in your configuration file.

In php.ini set

post_max_size = 20M

Your Answer

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

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