Location: PHPKode > scripts > File Importer > file-importer/sample.php
<?php
include('fileImporter.class.php');
?>
<form name="frmImportFile" enctype="multipart/form-data" method="post">
<input type="hidden" name="value" value="yes">
<table width="80%" cellpadding="0" cellspacing="0" border="0">
	<tr>
		<td>Import File</td>
		<td><input type="file" name="import_file" id="import_file" /><input type="submit" value="submit" /></td>		
	</tr>	
</table>
</form>
<?php
if ( $_POST['value'] == 'yes' ) {
    //set the temp dir
    echo $path = $_SERVER['DOCUMENT_ROOT'].'fileUploaded/temp/';
    //create an object of this class
    $importer = new fileImporter( $path , 'zend' , 'user' );
    //create DB connection, if DB is not connected
    $importer->connectDatabase( 'localhost', 'root' ,'');
    //set delimiter,by defult tab  
    $importer->setDelimiter('comma'); //FOR COMMA,use $importer->setDelimiter('comma');
    //import file
    if( $importer->importFile() ) {
       echo 'File imported successfully'; 
    } else {
        echo "Error Occured!Please try again";
    }    
}

Return current item: File Importer