<?php
include "koneksi.php";
?>

<form action="" method="post" enctype="multipart/form-data">
<tr class='first'>
    <td>Property Image : </td>
    <td>
        <input type="file" name="pic_upload[]" >
        <input type="file" name="pic_upload[]" >
        <input type="file" name="pic_upload[]" >
    </td>
</tr>
<tr class='first'>
    <td>&nbsp;</td><td><input type="submit" name="create" value="Add"  /></td>
</tr>
</form>
<?php

if(isset($_POST['create'])) {
    $path = "images/";
    for($i=0; $i<count($_FILES['pic_upload']['name']); $i++)
	{ $ext = explode('.', basename( $_FILES['pic_upload']['name'][$i])); 
	$path = "images/" . md5(uniqid()) . "." . $ext[count($ext)-1]; move_uploaded_file($_FILES['pic_upload']['tmp_name'][$i], $path);
	$res = mysqli_query($mysqli,"INSERT INTO post (image) VALUES ('$path')");
    echo "<p>Post Created</p>";
	};
}

?>  