Location: PHPKode > projects > ERPSOD > erpsod/load_trans.php

// Are you authorised?
if (!$ok){
	$fout = 'No Access for chosen option';
	header("Location: login.php?error=$fout"); 

if ($form1=="load_trans"){
	if ($action == "Cancel") {
		header('Location: copyright.php');
	$filelocal = $f['tmp_name'] ;
	$serverfile = _DIR_HOME . _DIR_UPLOAD . safe_filename($f['name']);
	// Do we have the upload directory?
	if (!is_dir(_DIR_HOME . _DIR_UPLOAD)) {
		//  Let's try to create it.
		if (!@mkdir(_DIR_HOME . _DIR_UPLOAD)) {
			//  If directory can't be made Set error message and output
			echo $serverfile;
			die(" problems creating upload directory, please verify installation");	
	if (!is_file($filelocal)) {
		echo $filelocal;
		die(" file does not exist");
	// delete existing copy
	if (is_file($serverfile)) {
	if (!copy($filelocal, $serverfile)) {
		//  Set error message and output
		die("cannot copy file to server, check installation");

	// clean the table
	$sql="truncate table erptrans";
	$result = mysql_query($sql);
	// load the fresh data
	$sql .= $serverfile;
	$sql .= "' INTO TABLE erptrans FIELDS TERMINATED BY ';' LINES TERMINATED BY '\n' (transname, transdesc)"; 
	$result = mysql_query($sql);
	Transaction Data has been loaded.............
<link rel="stylesheet" type="text/css" href="<?PHP echo $style ?>">
<script language="JavaScript1.2" src="js/coolmenus4.js">
<body bgcolor="#ffffff">
<script language="JavaScript1.2" src="js/erpsod.js">
<h3>Loading Transactions</h3>
<form enctype="multipart/form-data" method="post" >
<input type="hidden" name="form" value="load_trans" >
<table border=1 cellpadding=0 cellspacing=0 bgcolor="AQUA"><tr><td>
<tr><td align="center"><b>Select CSV file to reload transactions from</b></td></tr>
<input type="file" name="csv_file" size="50" />
<tr><td align="center">
<INPUT TYPE="SUBMIT" NAME="command" VALUE="Load" style="width: 80px;"   ONCLICK="return confirm('Replace Current Dataset?')">
<INPUT TYPE="SUBMIT" NAME="command" VALUE="Cancel" style="width: 80px;"><br>
Return current item: ERPSOD