I am having problem with a page that does the uploading multiple files onto the server . I have succeeded in uploading 1 file but for uploading many files a times seems to be too hard for me .Below is my code , the result of the code is displaying only the text"is not an image file" ( as i check the uploading file is "image/gif" ) . Anyone please tell me where am i wrong ?
PHP Code:

    session_start
();
    require 
'function.php';
    require 
'admin.inc';

    if(
Check_valid_user())
    {
        
$buttons  =  get_new_buttons();
           
$im = new admin();
        
$im->header('Uploading files' );
        
$im->Menu($buttons);
        
// Neu da an vao submit thi kiem tra loi , khong co loi thi cho xuat hien
    
if($submit)
    {
        
$error '';
        
$i=0;
        
//Lay id trong database
                
db_connect();
                
$re mysql_query("SELECT Max(id) FROM image ");
                 
$kqmysql_fetch_row($re);

        while((
$image[$i])&& ($image[$i]!='none'))
        {

                if(
$image[$i]["type"]!= "image/gif")
                {
                    
$error.="<br>&nbsp;&nbsp;&nbsp;".$image_name[$i] ."is not an image file .";
                    
$i++;
                    continue;
                }

                if(
$image_size[$i] > 300000)
                {
                    
$error .= "<br>&nbsp;&nbsp;&nbsp;".$image_name[$i] ."is over 300000 bytes.";
                    
$i++;
                    continue;

                }
                if(
$image_size[$i]==0)
                {
                    
$error.= "<br>&nbsp;&nbsp;&nbsp;".$image_name[$i] ."is zero length .";
                    
$i++;
                    continue;
                }
                if(!
is_uploaded_file($image[$i]))
                {
                        
$error.= "<br>&nbsp;&nbsp;&nbsp;Failed to upload ".$image_name[$i]." try again .";
                        
$i++;
                    continue;
                }

                
$filename="image".($kq[0]+1)."."."jpg";
                
$upload "../images/".$filename;
      
//Thuc hien chuyen thu muc
                
if(!copy($image[$i],$upload))
                {
                    
$error .= "<br>&nbsp;&nbsp;&nbsp;".$image_name[$i] ." cannot be moved .";
                    
$i++;
                    continue;
                }
                else
                {
                    
$error.="<br>&nbsp;&nbsp;&nbsp;".$image_name[$i] ." was uploaded successfully.";
                    
$i++;
                    continue;
                }
                
$imageurl[$i] = "../images/".$filename;
                if(
$caption[$i]=="")
                {
                     
$cap "Not available";
                }
                else
                {
                    
$cap $caption[$i];
                }

                
addimage($cap,$imageurl);
                
$kq[0]++;

}
// while
           // An vao submit , khong gap loi cho hien thi thong bao thanh cong
            
$header "<font color=red>Uploading files </font>";
            
$body =$error;
            
$im->below($header,$body);
            exit;

    }
    else  
// Chua an vao submit
    
{
        
$header="<center>
                    <font size=6 color=#FF0000>Upload images</font></p>
            </center>"
;
        
$body "&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Choose the
                    images from you computer to upload onto the server ,the images will
                    automatically be displayed on the Photo gallery page , then everybody                         can see   them .<br>
                     &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;The                             caption of the file field will be the
                     displayed on the right side of the image file  in the Photo gallery                         page .<br>
            <form method=POST action=
$PHP_SELF>
                  <table border=1 cellpadding=0 cellspacing=0 style='border-collapse: collapse' bordercolor='#111111' width='100%' height='271'>
                    <tr>
                      <td width='51%' height='19' bgcolor='#626BC1'>
                      <font color='#FFFFFF' size='4'>Images to be uploaded </font><br>
                      <font color='#FFFFFF' size=2>Click on the Browse button to select the files</font></td>
                      <td width='50%' height='19' bgcolor='#626BC1'>
                      <font size='4' color='#FFFFFF'>Caption of the files</font><br>
                      <font size='2' color='#FFFFFF'>Enter the caption for the image file
                      on same line </font></td>
                    </tr>
                    <tr>
                      <td width='51%' align='center' >
                      <p>
                      <input type='file' name=image[] size='20'><br>
                      <input type='file' name=image[] size='20'><br>
                      <input type='file' name=image[] size='20'><br>
                      <input type='file' name=image[] size='20'><br>
                      <input type='file' name=image[] size='20'><br>
                     </tr>
                      <td width='50%' align='center' >
                       <input type='text' name='caption[0]' size='36'>
                       <input type='text' name='caption[1]' size='36'><br>
                      <input type='text' name='caption[2]' size='36'><br>
                      <input type='text' name='caption[3]' size='36'><br>
                      <input type='text' name='caption[4]' size='36'><br>
                      </tr>
                    <tr>
                      <td width='200%' align='center' height='26' colspan='2'>
                         <input type='submit' value='Submit' name='submit'>&nbsp;&nbsp;&nbsp;&nbsp;</td>
                    </tr>
                  </table>
                  </center>
                  </form>
                </div> "
;
        
$im->below($header,$body);
        exit;
    }
    }
    else
    {
        echo 
'you have not logged in ';
    }