i am using array for uploading images but i am unable to insert it into database as well as in the folder. can anyone please help me to resolve it.

            $name = $_GET['name'];
            $gititle = $_POST['gititle'];

            $number_of_file_fields = 0;
            $number_of_uploaded_files = 0;
            $number_of_moved_files = 0;
            $uploaded_files = $_POST[$_FILES['images']['name'][$i]];
            echo $uploaded_files;
            $upload_directory = '../images/gallery/'.$name.'/'.$gititle.'/';
            echo $upload_directory;
    //set upload directory
     * we get a $_FILES['images'] array ,
     * we procee this array while iterating with simple for loop 
     * you can check this array by print_r($_FILES['images']); 
    for ($i = 0; $i < count($_FILES['images']['name']); $i++) 

        if ($_FILES['images']['name'][$i] != '') 

            { //check if file field empty or not


            $uploaded_files[$i] = $_FILES['images']['name'][$i];
            echo $uploaded_files[$i];
            if (move_uploaded_file($_FILES['images']['tmp_name'][$i], $upload_directory . $_FILES['images']['name'][$i])) {

            echo $sql=mysql_query("INSERT INTO ginnergallery (ginname,gifilename,giname)VALUES('".$_POST["gititle"]."', '".$uploaded_files[$i]."', '".$_POST["name"]."')");




Javascript Code

<script type="text/javascript">
/* function add_file_field(){
var container=document.getElementById('file_container');
var file_field=document.createElement('input');
var br_field=document.createElement('br');
$(document).ready(function() { 
var FileInputsHolder    = $('#AddFileInputBox');
var MaxFileInputs       = 30; //Maximum number of file input boxs
// adding and removing file input box
var i = $("#AddFileInputBox div").size() + 1;
$("#AddMoreFileBox").click(function () {
        event.returnValue = false;
        if(i < MaxFileInputs)
            $('<span><input type="file" id="fileInputBox" size="20" name="upl[]" class="addedInput" value=""/><a href="#" class="removeclass small2"><img src="images/close_icon.gif" border="0" /></a></span>').appendTo(FileInputsHolder);
        return false;
$("body").on("click",".removeclass", function(e){
        event.returnValue = false;
        if( i > 1 ) {



 <form class="form-horizontal form-separate" enctype="multipart/form-data" method="post" role="form">
      <div class="panel panel-default">
        <div class="panel-heading">
          <h6 class="panel-title"><i class="icon-page-break"></i> Add New Gallery</h6>
        <div class="panel-body">
          <div class="form-group">
            <label class="col-md-2 control-label">Title:</label>
            <div class="col-md-10">
              <input name="gititle" type="text" required class="form-control" value="<?php echo $gres['gititle']; ?>" id="gititle">
              <input name="name" type="hidden" class="form-control" id="name" value="<?php echo $name; ?>">
          <div class="form-group">
            <label class="col-md-2 control-label">Image:<br><span class="small"><a href="#" id="AddMoreFileBox">Add More Files</a></span></label>
                <div class="col-md-10">
                    <div id="AddFileInputBox"><input id="fileInputBox" style="margin-bottom: 5px;" type="file"  name="images[]"/></div>
          <div class="form-actions text-right">
            <input name="Reset" type="reset" class="btn btn-danger" value="Cancel">
            <input name="Submit" type="submit" class="btn btn-primary" value="Submit">

What do you ask ?
you want to create a new folder when uploading a file? then the name of the image file are entered into the database .

Using mkdir(), If you want to make folder according to the title in form the input and the images in a folder

 if (move_uploaded_file($tmp_name,  'uploads/'.$name.'/'.$gititle))

If you want to Add More Files, try to use this
<span class="small"><a href="#" id="AddMoreFileBox">Add More Files</a></span>

Replace with this

<span class="add_more"><a href="#" id="AddMoreFileBox">Add More Files</a></span>  

Call JS

    <script type='text/javascript'>
            $(this).before("<p><input name='image[]' type='file'/></p>");