I want to upload the csv file to the database so I am using word-press plug-in to do that . I have file size of 350 MB . Although I copied some data and save it to new file and now it has file size of 14 MB and total number of lines are 66872 .
When I try to upload that file the script don’t work after uploading 63296 lines of data in array . I check the forum and mostly say its a memory_limit issue . I even change the memory_limit = 2000M but it didn’t help .
Here is the code from plugin
function csv_file_data($file, $delim) {
$this->checkUploadDirPermission ();
ini_set ( "auto_detect_line_endings", true );
$data_rows = array ();
$resource = fopen ( $file, 'r' );
//print $file;
$init = 0;
while ( $keys = fgetcsv ( $resource, '', $this->delim, '"' ) ) {
print $keys;
print $init;
if ($init == 0) {
$this->headers = $keys;
} else {
array_push ( $data_rows, $keys );
}
$init ++;
}
//print_r($data_rows);
print $init;
fclose ( $resource );
ini_set ( "auto_detect_line_endings", false );
return $data_rows;
}