<center><b>Kvalitetsjekk av CSV</b><br /><br /><a href="#bottom">Til bunnen</a><br /><br /><?phpif(isset($_POST['move_do'])) { copy("products.csv", "../products.csv"); header("Location: ?page=upload&ok=1"); die();}if(!isset($_POST['csv_do'])) { header("Location: ?page=upload"); die(); }$tmpFile = $_FILES['csv_file']['tmp_name'];$newFile = "products.csv";move_uploaded_file($tmpFile, $newFile);$fp = fopen("products.csv", "r"); // Open the list$fline = fgetcsv($fp, 10000, ";"); // Get the first linefclose($fp); // Close it again/* CHECK WHAT DETERMINATOR I SHOULD USE */if(sizeof($fline) >= 3) { $det = ";"; } // It returned 3 or more cells, it is most likely ";"else { $det = ","; } // It dident return 3 or more cells, so then it should be ","$fp = fopen("products.csv", "r"); // Reopen to read from beginningecho "<table width=500 border=1>"; // Create tablesecho "<tr><td>Artikkel Nummer:</td><td>Produktnavn:</td><td>Pris per enhet</td></tr>"; // Headings while($data = fgetcsv($fp, 1000, $det)) { // LOOP thru the file with correct $det echo "<tr><td>{$data[0]}</td><td>{$data[1]}</td><td>{$data[2]}</td></tr>"; // Show product information}echo "</table>"; // End table?><div id="bottom"><br /><input type="button" value="TILBAKE" onClick="document.location='?page=upload'" /><br /><br /><form method="post" action=""><input type="submit" name="move_do" value="OK" /></form></div>