Good day ,wish to know how to upload multiple image files with multiple inputs and multiple directories. My code is
<table border="1px" width="100%"> <tr><td colspan="3" style="background-color:#E8E8E8"><b>Supporting documents upload</b></td></tr> <tr><td> </td><td colspan="3"><input style="height:35px;" type="file" name="pri" required ></td></tr> <tr><td> </td><td colspan="3"><input style="height:35px;" type="file" name="oresult" required ></td></tr> <tr><td> </td><td colspan="3"><input style="height:35px;" type="file" name="oresult2" required ></td></tr> <tr><td> </td><td colspan="3"><input style="height:35px;" type="file" name="dob" required ></td></tr> <table border="1px" width="100%"> <tr><td colspan="3" style="background-color:#E8E8E8"><b>Upload Passport Photograph</b></td></tr> <tr><td> </td><td colspan="3"><input style="height:35px;" type="file" name="photo" required ></td></tr> <tr><td> </td><td colspan="3"><div class="subm" ><input style="font-size:18px; height:45px; font-weight:bold; color:#0033FF" type="submit" style="height:50px" name="submit1" value="Save / Submit Form" ></div></td></tr> </table> </form>
and it connects to
<?php
require 'database.php';
$code_id = $_SESSION['SESS_CODE_NAME'];
$d = date('D d M Y');
$t = date('h : i : sA');
$uploadDir = 'student_pic/';
$fileName = $_FILES['photo']['name'];
$tmpName = $_FILES['photo']['tmp_name'];
$fileSize = $_FILES['photo']['size'];
$fileType = $_FILES['photo']['type'];
$filePath = $uploadDir . $fileName;
$result = move_uploaded_file ($tmpName, $filePath);
if (!$result){
echo "error uploading file";
exit;
}
if(!get_magic_quotes_gpc())
{
$fileName = addslashes ($fileName);
$filePath= addslashes ($filePath);
}
$q = mysql_query ("SELECT * FROM studentreg WHERE jamb='$jamb'");
$ja = mysql_fetch_assoc($q);
if ($ja > 0){
echo '
<script type="text/javascript">
alert("This Jamb Number has already been taken")
</script>';
}
else{
$query = "INSERT INTO studentreg (pri, oresult, oresult2, dob, photo) VALUES ('$pri', '$oresult', '$oresult2', '$dob', '$filepath)";
Thank you.