<?php
error_reporting(E_ALL);
$target_dir = "uploads/";
$file_name = basename($_FILES["fileToUpload"]["name"]);
$target_file = $target_dir . $file_name;
// if everything is ok, try to upload file
if (move_uploaded_file($_FILES["fileToUpload"]["tmp_name"], $target_file)) {
echo "The file " . $file_name . " has been uploaded.<br><br>";
echo "Click submit to start processing the file";
if (finfo_file(finfo_open(FILEINFO_MIME, "/usr/share/misc/magic"), $target_file) != "text/csv") {