title: PHP Insert session name into path
body: <p>Sorry for my english. I use form to send a file then I want to use $_SESSION to create user's dir where will be stocked that file. Create dir works but doesn't send into the "user's session" dir. File is send to the root of my "uploads" dir (instead of uploads/$_SESSION['myusername']/. I think it's because "/" is missing but I tried different things and got syntax errors. Any help would be appreciated. My actual code is :</p>
  
  <pre><code>&lt;?php
  session_start();
  
  $target_dir = 'uploads/'.$_SESSION['myusername'];
  $target_file = $target_dir . basename($_FILES["fileToUpload"]["name"]);
  $uploadOk = 1;
  $imageFileType = pathinfo($target_file,PATHINFO_EXTENSION);
  if (!file_exists($target_dir)) {
      mkdir($target_dir, 0777, true);
  }
  // Check file size
  if ($_FILES["fileToUpload"]["size"] &gt; 20000000) {
      echo "Sorry, your file is too large.";
      $uploadOk = 0;
  }
  // Check if $uploadOk is set to 0 by an error
  if ($uploadOk == 0) {
      echo "Sorry, your file was not uploaded.";
  // if everything is ok, try to upload file
  } else {
      if (move_uploaded_file($_FILES["fileToUpload"]["tmp_name"], $target_file)) {
          echo "The file ". basename( $_FILES["fileToUpload"]["name"]). " has been uploaded.";
      } else {
          echo "Sorry, there was an error uploading your file.";
      }
  }
  ?&gt;
  </code></pre>