title: Upload a file of a certain name length
body: <p>My code looks like this:</p>
  
  <pre><code>$uploaded=0;
  $ext="";
  
  $uploaded_file_name= strtolower($_FILES['uploaded_file']['name']);
  
  $name_file = explode('.', strtolower(basename($_FILES['uploaded_file']['name'])));
  $file_name= $name_file[0];
  $file_ext=$name_file[1];
  $file_length=strlen($file_name);
  
  $i=strlen($file_name);
  while ($i++&lt;8) {
      $file_name .= "0";
  }
  echo "file_name.ext =" . $file_name . "." . $file_ext;
  
  //do we have a file?
  if((!empty($_FILES["uploaded_file"])) &amp;&amp; ($_FILES['uploaded_file']['error'] == 0))
  {
  
  
     if ((($file_ext == "jpg")||($file_ext == "png")) &amp;&amp; ($_FILES["uploaded_file"]["size"] &lt; 100000)&amp;&amp;(($_FILES["uploaded_file"]["type"] == "image/jpeg")||($_FILES["uploaded_file"]["type"] == "image/png")))
     {
     //Determine the path to which we want to save this file
      $newname = "images/backgrounds/" . $file_name . "." . $file_ext;
  
         if ((move_uploaded_file($_FILES['uploaded_file']['tmp_name'],$newname)))
         {
         echo "File uploaded successfully!";
         $uploaded=1;
         }
         else
         {
          echo "Error:!";
          print('&lt;p&gt;&lt;a href="../../admin.php?"&gt;Back&lt;/a&gt;&lt;/p&gt;');
         }
     } else {
     echo "Error: Only .jpg or .png files are allowed less than 100Kb";
     print('&lt;p&gt;&lt;a href="../../admin.php"&gt;Back&lt;/a&gt;&lt;/p&gt;');
     }
  } else {
  echo "Error! File is not uploaded!";
  print('&lt;p&gt;&lt;a href="../../admin.php"&gt;Back&lt;/a&gt;&lt;/p&gt;');
  }
  </code></pre>
  
  <p>The file name is corrected and filled up with <code>0</code> if it is too short. I tried to upload a file with extensions .jpg .jpeg .pnp </p>
  
  <p>Apache shows me the errors:</p>
  
  <pre><code>[Mon Feb 24 16:51:54.754787 2014] [:error] [pid 2620] [client 127.0.0.1:39685] PHP Warning:  move_uploaded_file(images/backgrounds/on-off00.jpg): failed to open stream: No such file or directory in /var/www/BB/core/functions/admin_background.php on line 49, referer: http://localhost/BB/admin.php
  [Mon Feb 24 16:51:54.754813 2014] [:error] [pid 2620] [client 127.0.0.1:39685] PHP Warning:  move_uploaded_file(): Unable to move '/tmp/phpmbc7kZ' to 'images/backgrounds/on-off00.jpg' in /var/www/BB/core/functions/admin_background.php on line 49, referer: http://localhost/BB/admin.php
  [Mon Feb 24 16:51:54.754844 2014] [:error] [pid 2620] [client 127.0.0.1:39685] PHP Notice:  Array to string conversion in /var/www/BB/core/functions/admin_background.php on line 69, referer: http://localhost/BB/admin.php
  </code></pre>
  
  <p>What could be the reason that it cannot find the file in the /tmp directory?</p>