• Upload multiple images using php

    For multiple image uploading using php, following two php files are required at same path. Also create one folder named ‘upload’ at the same path of these two files.


    index.php

    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    33
    34
    35
    36
    37
    38
    39
    40
    41
    42
    43
    
    <script type="text/javascript">// <![CDATA[
    function isInteger(s)
        {
     
            var cle=document.getElementById('imgsize');
            var i;
              s = s.toString();
             for (i = 0; i < s.length; i++)
             {
                 var c = s.charAt(i);
                  if (isNaN(c))
                     {
                         cle.value="";
                     cle.focus;
                     alert("Please Enter number Only");
                         return false;
                    }
              }
          return true;     
        }
        function chkval()
      {
          var numimg=document.imageupload.imgsize.value;
          if(numimg.length==0)
          {
     
            return false;
          }
     
      }
    function ctck()
    {
         var sds = document.getElementById("dum");
         if(sds == null){
            alert("You are using a free package.\n You are not allowed to remove the tag.\n");
         }
         var sdss = document.getElementById("dumdiv");
         if(sdss == null){
             alert("You are using a free package.\n You are not allowed to remove the tag.\n");
         }
    }
    document.onload ="ctck()";
    // ]]></script>
    Multiple Image Upload Script

    Images to Upload:
    [Note:Maximum Upload Images 9]

    imgload.php

    1
    2
    3
    4
    5
    6
    
    <!--?php 
    error_reporting(0);
     
    $imgsize = $_POST['imgsize'];
    echo '
    <table align=center cellpadding=10 cellspacing=10 style="font-family: Monaco, Verdana, Sans-serif; font-size: 12px;background-color: #f9f9f9;border:1px solid #D0D0D0;color: #002166;width:50%;"-->

    Multiple Image Upload Script

    1
    2
    3
    4
    5
    6
    7
    8
    
    ';
    for($i=1;$i&lt;=$imgsize;$i++)
         {
          $form_img.='<label> Image'.$i.':</label><input id="img" type="file" name="img'.$i.'" />';
         }
      if(sizeof($_FILES)==0)
     {
          $htm.='
    ‘.$form_img.’<br?> ‘;
    echo $htm;
    }
    echo “”;
    foreach($_FILES as $arr => $k)
    {if($_FILES[$arr]['size']Image Name :”.$_FILES[$arr]['name'].”
    “;
    echo “Image Size :”.$_FILES[$arr]['size'].”
    “;
    echo “image Type :”.$_FILES[$arr]['type'].”
    “;
    echo ““;
    echo “

    “; } else { echo ” Invalid ImageType :”.$_FILES[$arr]['name'].”

    “; } } else { echo ” Invalid image”; } } echo ‘

    ‘; ?>

    Tags:

Comments on this post

Leave a Reply

  • Security Code :


    six × = 36