title: file upload / mkdir() problems
body: <p>I'm trying to create a fairly simple (in theory) file upload 'process'. I've trawled through the site and, although there are snippets of what I need, nothing seems to work!</p>
  
  <p>Basically, I am trying to create a function that processes as below:</p>
  
  <ol>
  <li>Get file extension</li>
  <li>Get file name</li>
  <li>Combine file name, clientID and extension</li>
  <li>Check that the target directory exists. If not, create it.</li>
  <li>Move the file(under the new name) into the directory</li>
  </ol>
  
  <p>My file structure is as follows:</p>
  
  <ul>
  <li>Root
  <ul>
  <li>admin
  <ul>
  <li>uploads
  <ul>
  <li>client_uploads
  <ul>
  <li>$clientID</li>
  </ul></li>
  </ul></li>
  </ul></li>
  </ul></li>
  </ul>
  
  <p>Here's what I have:</p>
  
  <pre><code> &lt;?php
   include("dbconnect.php");
  
   error_reporting(-1); // ALL messages and 
   ini_set('display_errors', 'On');
  
   if($_GET['clientID']){
  
   //This function separates the extension from the rest of the file name and returns it 
   function findexts ($filename) 
   { 
   $filename = strtolower($filename) ; 
   $exts = split("[/\\.]", $filename) ; 
   $n = count($exts)-1; 
   $exts = $exts[$n]; 
   return $exts; 
   } 
  
   //Get filename function
   $filename = "test"; //I dont know how to create this function at the moment
   return $filename;
  
   //This applies the function to our file  
   $ext = findexts ($_FILES['uploaded']['name']) ; 
  
   // we will be using the clientID as the new folder and adding it into the filename
   $clientID = mysql_real_escape_string((int)$_GET['clientID']);
  
   //merge filename
   $filename2 = $filename."_".$clientID.".";
  
   //Scan for existing directory
   $folder = '../admin/uploads/client_uploads/'.$username.'/';
   if (is_dir("$folder") == false) {
   mkdir("$folder", 0777);    
   echo "Directory created";
   } 
  
  
   //This assigns the subdirectory you want to save into... make sure it exists!
   $target = "admin/client_uploads/$clientID";
  
   //This combines the directory, the random file name, and the extension
   $target = $target . $filename2.$ext; 
  
   //Move file under new name 
  
   if(move_uploaded_file($_FILES['uploaded']['tmp_name'], $target)) 
   {
   echo "The file has been uploaded as ".$filename2.$ext;
   } 
   else
   {
   echo "Sorry, there was a problem uploading your file.";
   }
  }
  ?&gt;
  </code></pre>
  
  <p>I'm not getting any error messages (although I've explicitly asked for them) and I just end up with a blank screen. Folder is not created anywhere on my server and nothing happens.</p>
  
  <p>Any ideas? Thanks in advance.</p>