title: restricting the uploading files size in php
body: <p>I am working with multiple file upload in PHP and I also fixed an upload limit of 10MB using the following HTML commands in an upload form PHP file:</p>
  
  <pre><code>   &lt;input type="hidden" name="MAX_FILE_SIZE" value="10000000"&gt; 
     &lt;input id="infile" type="file" name="infile[]" multiple="true" /&gt;
  </code></pre>
  
  <p>In the PHP file that takes care of upload function I was initially expecting that if I try to upload a file of size greater than 10MB then the function call statement </p>
  
  <pre><code>   move_uploaded_file($_FILES['infile']['tmp_name'][$i], $dir . $fPath);
  </code></pre>
  
  <p>will fail and I can show an "Error upload file of size less than 10MB" message. But it didnt happen. It was trying to upload and it didnt display any error message as expected. </p>
  
  <p>So I tried to restrict the file size specifically in the code by using the if statement as:</p>
  
  <pre><code>  if ($_FILES["infile"]["size"][$i]&lt;10000000) 
      {
         move_uploaded_file($_FILES['infile']['tmp_name'][$i], $dir . $fPath);
      }
    else
      echo "error";
  </code></pre>
  
  <p>But still it doesnt echo error as expected. Can anyone please point out the mistake I am doing here?</p>