$val) { $doc_name = $_FILES['docphotoone']['name'][$key]; $tmp_name = $_FILES['docphotoone']['tmp_name'][$key]; $size = $_FILES['docphotoone']['size'][$key]; $type = $_FILES['docphotoone']['type'][$key]; $error = $_FILES['docphotoone']['error'][$key]; // File upload path $code = time(); $fileName = basename($_FILES['docphotoone']['name'][$key]); $fileName = $idtrf . '-' . $code . $fileName; $targetFilePath = $targetDir . $fileName; // Check whether file type is valid $fileType = strtolower(pathinfo($targetFilePath, PATHINFO_EXTENSION)); if (in_array($fileType, $allowTypes)) { // Store images on the server if (move_uploaded_file($_FILES['docphotoone']['tmp_name'][$key], $targetFilePath)) { $docs_arr[] = $targetFilePath; $UpdateQuery = new WA_MySQLi_Query($cmctrfdb); $UpdateQuery->Action = "update"; $UpdateQuery->Table = "`trf-details`"; $UpdateQuery->bindColumn("photoone", "s", "$fileName", "WA_DEFAULT"); $UpdateQuery->addFilter("idtrfdetails", "=", "i", "" . ($idtrf) . ""); $UpdateQuery->execute(); $UpdateGoTo = ""; if (function_exists("rel2abs")) $UpdateGoTo = $UpdateGoTo ? rel2abs($UpdateGoTo, dirname(__FILE__)) : ""; $UpdateQuery->redirect($UpdateGoTo); } } } // Generate gallery view of the images ?>