Read csv file in php

<?php
$filename = str_replace(“.”,date(‘-Y-M-d-D-H-i-s.’),$_FILES[‘upload’][‘name’]);
echo “<table border=’1′>”;
if (($handle = fopen($filename, “r”)) !== FALSE) {
while (($data = fgetcsv($handle, 1000, “,”)) !== FALSE){ ?>
<tr><?php foreach($data as $values) {?><td > <?php echo $values ?></td><?php } ?></tr>
<?php }
}
echo “</table>”;
?>

Leave a Reply

Your email address will not be published. Required fields are marked *