"; echo "

File Comparison Report


"; echo " File Comparer "; echo ""; $dir = "../FileCompare/upload"; //directory of files to compare //$obj = new Compare(); Compare::saveFile($dir); echo "File Compared: ".Compare::getFile1(0)."

"; //displays the uploaded file so we know what file we are comparin foreach (Compare::getFile2($dir) as $key => $value) { //takes the files from the array of the directory of file2 //for($i = 0; $i"; } else { // files the same echo "
"; echo "yes: ".$value."
"; echo "
"; } //} } //echo "
"; //back button echo "
"; //back button echo ""; echo ""; class Compare { static function compareFiles($dir, $file11, $files22) { $files22 = scandir($dir, 1); //read the directory of files to compare and put it into an array } static function getFile1($i) { return $_FILES[$i]['name']; } static function convertFile($fileName) { global $dir; if (file_exists($dir . '/' . $fileName)) { $crc = @crc32($dir . '/' . $fileName); return $crc; } else { echo "failed to find($fileName)"; } } static function getFile2($dir) { $files22 = scandir($dir, 1); //read the directory of files to compare and put it into an array array_pop($files22); array_pop($files22); return $files22; } static function saveFile($dir) { array_shift($_FILES); $_FILES = array_values($_FILES); //print_r($_FILES); foreach($_FILES as $key => $value) { $target_path = $dir."/".basename($value['name']); if(move_uploaded_file($value['tmp_name'], $target_path)) { echo "The file ". basename($value['name'])." has been uploaded
"; } else{ echo "There was an error uploading the file, please try again!
"; } } } } ?>