PHP rename function problem
<p>I'm trying to move a file on my server from one folder to another using the php rename function, but I'm getting this error</p>

<blockquote>
  <p>Warning: rename(/home/pramiro/public_html/new/cipri/adauga/tmp/Koala.jpg, /home/pramiro/public_html/new/images/memo/Koala.jpg) [function.rename]: No such file or directory in /home/pramiro/public_html/new/cipri/adauga/categorie.php on line 13</p>
</blockquote>

<p>The paths are good, the folders exist and the file to be copied is in the tmp folder.What could I be doing wrong?</p>

<p>This is the code:</p>

<pre><code>$filename=$_POST['poza_conv'];
$filename=substr($filename,37);
$old_path='/home/pramiro/public_html/new/cipri/adauga/tmp/'.$filename;
$new_path=' /home/pramiro/public_html/new/images/';
switch($_POST['categorie_conv'])
{
    case 'memo': $filename=$new_path.'memo/'.$filename;
    break;
    case 'ort_sup': $filename=$new_path.'ort_sup/'.$filename;
    break;
}

rename($old_path,$filename);
</code></pre>
