500000) { echo "Sorry, your file is too large."; $uploadOk = 0; } // allow certain file formats if ($imageFileType != "pdf") { echo "Sorry, only PDF files are allowed."; $uploadOk = 0; } // check if $uploadOk is set to 0 by an error if ($uploadOk == 0) { echo "Sorry, your file was not uploaded."; // otherwise upload file } else { if (move_uploaded_file($_FILES["fileToUpload"]["tmp_name"], $target_file)) { echo "The file " . htmlspecialchars(basename($_FILES["fileToUpload"]["name"])) . " has been uploaded."; } else { echo "Sorry, there was an error uploading your file."; } } // process file $output = shell_exec("java -jar TaskSheetChecker.jar " . $target_dir . htmlspecialchars(basename($_FILES["fileToUpload"]["name"]))); $keySeparator = ','; $delimiter = ';'; $key_array = array(); $value_array = array(); $currentString = ""; for ($i = 0; $i < strlen($output); $i++) { if ($output[$i] == ',') { array_push($key_array, $currentString); $currentString = ""; } else if ($output[$i] == ';') { array_push($value_array, $output[$i]); $currentString = ""; } else { $currentString = $currentString . $output[$i]; } } echo count($key_array) . "
"; echo count($value_array); foreach ($value_array as &$value) echo $value . "
"; ?> Upload PDF