How to upload a csv file with an admin form? In a custom module, I created an admin form but I need an input to upload a csv file. When the file is uploaded I need to parse in and then I add data to db.

I already made "add to db" and "parsing" functions because when I installed the module, a default file is parsing and added to the db.

Thanks.

EDIT : 

I'm using Drupal 7...

The data is stocked in a custom table that is create when the admin user will install the module. There is no node or content type. I just need to save all data of the CSV file (5 columns) in the table by an admin user form. 1 time par month the admin user need to update the table with a new .CSV. 

In frontend I have a form and when the user will submit it I check that the code is in the table.

My issue is that I didn't know how to upload the file into a Drupal directory and then access to it after the form submit.

As I said above I already created a parsing function and I tested with a CSV file directly in the module directory, it's working. Data is insert into the table that I have created.
In your custom form create input button like

$form['upload_csv'] = array(
        '#name' =&gt; 'files[mycsv_data]',
        '#type' =&gt; 'file',
        '#title' =&gt; 'Upload csv'
    );


Next in form submit you can use 

file_save_upload($source,
                array('file_validate_extensions' =&gt; array('csv')),
                $destination_dir,
                FILE_EXISTS_REPLACE)

Here for getting uploaded file details like file name and file path you can use $_FILES global variable.


and then, 

if ($file) {
    $file-&gt;status = FILE_STATUS_PERMANENT;
    file_save($file); 
}