Why is my upload-of-a-file code putting 2 sets of files into my directory? (PHP)
<p>When I upload a file using this code, it puts a copy of the file in the "uploads" folder(which is what I want) but it also puts a copy in my root. I only want the files going to the uploads folder.</p>

<pre><code>    define ('GW_UPLOADPATH', 'uploads/');
$upfile= GW_UPLOADPATH . $_FILES['userfile']['name'];

if(is_uploaded_file($_FILES['userfile']['tmp_name']))
{
    if(!move_uploaded_file($_FILES['userfile']['tmp_name'], $upfile)) //this is saying if the file isn't moved to $upfile.
    {
        echo 'Problem: could not move file to destination directory';
        exit;
    }
}
else
{
    echo 'Problem: Possible file upload attack. Filename: '; //this could be an attack b/c it might be from localhost.
    echo $_FILES['userfile']['name'];
    exit;
}

echo 'File uploaded successfully&lt;br&gt;&lt;br&gt;';
</code></pre>
