Jump to content

Upload and process CSV in configForm


Recommended Posts

Hi,

I'm trying to create a module that generate a database with car brand and models but I'm facing complications and I need you guys.

 

I'm trying to upload a csv file in config form and then update my table with the value in the csv file.

 

But I don't know how can I render my csv file to an array, I know that there is str_getcsv in php, but I don't know where can I get the value from the CSV file that I've just uploaded with :

'input' => array(
                    array(
                        'name' => 'CPFILTER_CARDATABASE',
                        'type' => 'file',
                        'accept' => '.csv',
                        'desc' => $this->l('Import your CSV file'),
                        'label' => $this->l('Car Database'),
                    )

In getConfigForm().

 

I saw that it's in postProcess function, but what I do to get the value from the CSV just uploaded ?

Edited by jmauclair
Error (see edit history)
Link to comment
Share on other sites

  • razaro changed the title to Upload and process CSV in configForm

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...