Source for file upload_csv.php
Documentation is available at upload_csv.php
* A script which is used to upload a CSV into a specific table.
* This file is part of HRDIODB.
* HRDIODB is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
* HRDIODB is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* You should have received a copy of the GNU General Public License
* along with HRDIODB; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
/** Configuration file */
require_once("conf.php");
/** Debugging functions */
require_once("debugging.php");
/** HRDI database class */
require_once("hrdi_db_class.php");
require_once("csv_loader_class.php");
// Check to make sure we have a file to upload
error("You must specify a valid CSV file's name");
/* The initial import of hrdi data uses much memory because we have
* chosen to parse all data before uploading to the database
// Set time limit to 0 so that the script never times out
/* Create an object for using pear to write to the database specified by the
* $dsn in the conf.php file. */
// Pass the target database object to the parser
// Pass a list of table / key pairs to the parser from conf.php.
$parser->set_table_keys($table_keys);
// Pass the data file to the parser
$parser->set_file($argv[1]);
// Display a summary of the parsed data
$parser->print_file_info();
// Push the parsed data to the database
|