Concat in php not the right file path
<p>Im trying to get an image called what ever the user submits.png from the tmp folder and put it in the folder of Business_Names/whatever the user enters. Im having trouble concating in php the error it gives me is that the file doesnt exists </p>

<pre><code> $filename = str_replace(" ","_", trim($username) ); 
    mkdir("Business_Pages/". $filename."/");
    if( $fp = fopen("Business_Pages/". $filename . "/" . $filename . ".php", "w") )
    {
      fwrite($fp,"&lt;?php session_start();");
      fwrite($fp,"if(isset(\$_SESSION['id'])) { ?&gt;");

      fwrite($fp, $doctype.$htmlOpen.$head.$bodyOpen.$header.$wcImage.$accountTable.$linksTable.$bodyClose.$htmlClose);

      fwrite($fp,"&lt;?php } else { echo \"User not logged in\";} ?&gt;");
      fclose($fp);
    }

    $tmpdir = "tmp/";
    $userdir = "Business_Pages/ . $filename . '/' ";
    rename("$tmpdir . $filename . '/' . '.png'",
           "$userdir . $filename . '/' '.png'");
</code></pre>
