move uploaded file issue
<pre><code>&lt;?php
ini_set('display_errors',1);
error_reporting(E_ALL); 
    session_start();
    $targ_w = $targ_h = 150;
    $jpeg_quality = 90;
    $ext=$_GET['ext'];
    $src = $_GET['p'];

    $img_r = imagecreatefromjpeg($src);
    $dst_r = imagecreatetruecolor( $targ_w, $targ_h );

    imagecopyresampled($dst_r,$img_r,0,0,$_POST['x'],$_POST['y'],
    $targ_w,$targ_h,$_POST['w'],$_POST['h']);

    unlink($src);
    imagejpeg($dst_r,$src,$jpeg_quality);
    rename($src,"img/temp_images/".$_SESSION['userid'].".".$ext);

    $result=move_uploaded_file(
                        "/img/temp_images/".$_SESSION['userid'].".$ext",

                        "/img/".$_SESSION['userid'].".$ext");
    if($result)
    echo "Success";
    else
    echo "&lt;br&gt;Fail";


?&gt;
</code></pre>

<ol>
<li>Safe mode is off</li>
<li><p>No error is displayed despite of putting the following code</p>

<p>ini_set('display_errors',1);
error_reporting(E_ALL); </p></li>
<li><p>The system is running on localhost</p></li>
<li>Everything is working except move_uploaded_file() function</li>
<li>The code is called from an iframe.</li>
<li>Also I have tried directory(<strong>FILE</strong>) and many alternatives</li>
</ol>

<p>Please suggest a solution or a reason to the problem. Do I need to catch the error/warning somewhere using the firs 3 lines? I'm running this on a XAMPP setup ver 2.5.8. I assume since I'm able to create files, I have the permissions to move the file to a folder. And I guess on a localhost there is no hassle for permissions?</p>
