title: php file upload error of 1 - What is correct way to use php_ini?
body: <p>I'm having issues uploading a pdf to my server.  The upload_max_filesize is 2M and the file(s) are more then that, around 4M.  I found a post with a similar issue to mine here</p>
  
  <p><a href="https://stackoverflow.com/questions/4255617/file-upload-large-file-gives-error-1-even-though-upload-max-size-is-bigger-tha">$_FILE upload large file gives error 1 even though upload_max_size is bigger than the file size</a></p>
  
  <p>What I can gather from php.net for the correct usage of ini_set commands is this, which I am currently using.</p>
  
  <pre><code>    ini_set('upload_max_filesize', 100000000);
      ini_set('post_max_size', 110000000);
      ini_set('memory_limit', 120000000);
      ini_set('max_input_time', 20);
  </code></pre>
  
  <p>But in the link I posted it seems they are using a different method (if they aren't just summarizing the correct code that is).  But It seems my code isn't working as is either.  I have <code>&lt;?php phpinfo(); ?&gt;</code> at the bottom of my page and it says the upload_max_filesize is still 2M.  Am I using the correct syntax for ini_set?  or is my issue with upload my pdfs something else?</p>
  
  <p>My code handling the upload is</p>
  
  <pre><code>    //======================pdf upload=====================     
      if ($_POST['erasePDF'] == "Yes") //checking if erase box was checked and erasing if true
      {   
          if (file_exists($pdf))
          {
              unlink( $pdf );
              $pdf = "";
          }
      }   
  
      print_r($_FILES['pdf']);
      if (!empty($_FILES['pdf']['name'])) //checking if file upload box contains a value
      {
          $saveDirectoryPDF = 'pdfs/';            //name of folder to upload to
          $tempName = $_FILES['pdf']['tmp_name']; //getting the temp name on server
          $pdf = $_FILES['pdf']['name'];      //getting file name on users computer
  
          $test = array();
          $test = explode(".", $pdf);
          if((count($test) &gt; 2) || ($test[1] != "pdf" &amp;&amp; $test[1] != "doc" &amp;&amp; $test[1] != "docx")){
              echo "invalid file";
          }else{
  
              $count = 1;
              do{
              $location = $saveDirectoryPDF . $count . $pdf;
              $count++; 
              }while(is_file($location));
  
              if (move_uploaded_file($tempName, $location))   //Moves the temp file on server
              {                                                           //to directory with real name
                  $pdf = $location;
              } 
              else 
              {
  
                  echo "hi";
                  echo '&lt;h1&gt; There was an error while uploading the file.&lt;/h1&gt;';
              }
          }
      }else{
          $pdf = "";
      }
      if(isset($_POST['link']) &amp;&amp; $_POST['link'] != ""){
          $pdf = $_POST['link'];
      }
      //======================end of pdf upload==============
  </code></pre>
  
  <p>The output of the line 'print_r($_FILES['pdf']);' is</p>
  
  <pre><code>    Array ( [name] =&gt; takeoutmenu.pdf [type] =&gt; [tmp_name] =&gt; [error] =&gt; 1 [size] =&gt; 0 )
  </code></pre>