if (in_array(strtolower($ext), $allowed_extensions)) { $target_dir = "debt-recovery/files/"; $target_file = $target_dir . 'import-list-' . date('Y-m-d-h-i-s') . "." . $ext; if (move_uploaded_file($_FILES['file']['tmp_name'], $target_file)) { // start import $import_list = array(); if (file_exists($target_file) && ($handle = fopen($target_file, 'r')) !== false) { while ($line = fgetcsv($handle)) { if (!is_array($line) || count($line) != 2) { continue; } $import_list[] = array($line[0], $line[1]); } fclose($handle); } $debt_manager->loadDebtors($import_list); $debt_recovery->import_filename = $target_file; $debt_recovery->save(); $success = sprintf('Successfully imported %s debtor records from the file.', count($debt_manager->getDebtors())); } else { $error = "Failed to upload the specified file."; } } else { $error .= 'Invalid file extension. Allowed files are: ' . explode(', ', $allowed_extensions) . '<br>'; } // header('Location: debt-recovery-runs.php?debt_recovery_id'.$debt_recovery_id); // exit; } $subMenus = Tracetec_Debt_Manager::getSubMenus(); include "include/head.php"; ?>