if (isset($_POST['Submit'])) { switch ($_POST['Submit']) { case 'Segregate': if (!empty($_FILES["fileUpload"]) && $_FILES['fileUpload']['error'] == 0) { //Сheck that we have a file $filename = basename($_FILES['fileUpload']['name']); $ext = substr($filename, strrpos($filename, '.') + 1); //echo 'File extension: '.$ext."</br>"; if ($ext == "xml" && $_FILES["fileUpload"]["type"] == "text/xml") { $file = $_FILES['fileUpload']['name']; $testObj = $objDoc->fileExist($file); /* @check to see if there is a similar file located in uploads_temp * -> proceed to delete the file if it exists * */ if ($testObj == 'TRUE') { if ($objDoc->fileDel($file) == 'TRUE') { echo 'previous copy of ' . $file . ' has been deleted</br>'; } else { echo 'file not deleted.'; } } else { echo 'file ' . $file . ' does not exist... Creating file.....'; } $url = 'D:/xampp/htdocs/dslweb/'; //change directory first chdir($url); if (move_uploaded_file($_FILES['fileUpload']['tmp_name'], "uploads_temp/{$_FILES['fileUpload']['name']}")) { $sDatas = $objDoc->fileCreate($file); /* instantiate a new (clean) file PSI_DSL_INPUT.txt */ foreach ($sDatas as $sData => $values) { $GLOBALS[$sData] = $values;