用PHP轻松上传文件[关闭]

I have tried this tutorial : http://www.tutorialspoint.com/php/php_file_uploading.htm

And no success :(

I do not understand the point where this guy states

The following example below attempts to copy a file uploaded by the HTML Form listed in previous section page to /var/www/html directory which is document root of your PHP server

I tried using the filesystem path to the php script : I:\xampp\htdocs\tester\ (normally the .php is here) and it wouldn't work.

I get this error :

Warning: copy(stock-footage-hand-presses-a-confidential-stamp-contains-matte.jpg) [function.copy]: failed to open stream: No such file or directory in I:\xampp\htdocs\tester\uploader.php on line 4

Could not copy file!

I do not understand what i am doing wrong, and if you could give me a little example, i would greatly appreciate.

<?php
if(isset($_REQUEST["uploadnow"]))
{
    $directory  = "images/";    //directory name where the image should get stored
    $imageDet   = $_FILES["uploadfile"];
    if($imageDet["name"]!="")
    {
        //source as tmpname and destination as destination directory
        copy($imageDet["tmp_name"],$directory.$imageDet["name"]);
    }
}
?>

<form method="post" enctype="multipart/form-data">
    <input type="file" name="uploadfile" />
    <input type="submit" value="Upload Now" name="uploadnow" />
</form>

Hope the above code would be helpful. and note that the directory (the destination directory) has to be present for uploading. Note : method="post" and enctype="multipart/form-data" is must when you upload a file from form.