private static function saveFileToProject($filename, $pid) { $data = array(); $row = 1; if (($fhandle = fopen($filename, "r")) !== FALSE) { while (($d = fgetcsv($fhandle, 10000, ",")) !== FALSE) { // process row specially if ($row == 1) { $field_names = $d; } else { $data[] = $d; } $row++; } // call validation routines $project = new Project($pid); $project->saveProjectData($data, array('field_names' => $field_names, 'pid' => $pid)); fclose($fhandle); // unlink file. No need to clog up space } else { error_log("Could not open file[" . $a_response['filename'] . "]"); } }