I want to import CSV file in MySQL using CodeIgniter, I am defined names and right functions(hope so), but getting the undefined index of my file I m finding solutions and also getting one but won't work.
Controller
$file_data = $this->csvimport->get_array($_FILES['csvfile']['name']);
foreach($file_data as $row)
{
$data[] = array(
'Hall_Ticket_No' => $row['Hall_Ticket_No'],
'Name' => $row['Name'],
'Course' => $row['Course']
);
}
$data['query'] = $this->ExamModel->insertBlock($data);
HTML
<div class="form-group col-lg-12 col-xs-12">
<label for="csv_file">Select excle (CSV) file:</label>
<input type="file" name='csvfile' accept=".csv" class="form-control" id="csv_file" required="">
</div>
Error
Severity: Notice
Message: Undefined index: csvfile
Filename: controllers/Exam.php
Line Number: 20