开发者

Why is my upload-of-a-file code putting 2 sets of files into my directory? (PHP)

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.

    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<br><br>';


What would be your temporary dir? Is it possible that somehow the uploaded file lands in the root but PHP can not delete it? Figuring this out requires a lot more knowledge about your setup.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜