I tried this code.

$url = http://www.test.com/conf/test.jpg;
$dst = "./dst/file/data/thumb/";
if(!@copy($img_path,$dest_file))
{
    $errors= error_get_last();
    echo "COPY ERROR: ".$errors['type'];
    echo "<br />\n".$errors['message']."<br />\n";
} else {
    echo "File copied from remote!";
}

And I have this error message.

COPY ERROR: 2
copy(./dst/file/data/thumb/) [function.copy]: failed to open stream:

What is this error?

    bradgrafelman,

    Thank you for your kind reply.

    I changed as follows, but same result.

    $url = "http://www.test.com/conf/test.jpg";
    $dst = "./dst/file/data/thumb/";
    if(!@copy($img_path,$dest_file))
    {
    $errors= error_get_last();
    echo "COPY ERROR: ".$errors['type'];
    echo "<br />\n".$errors['message']."<br />\n";
    } else {
    echo "File copied from remote!";
    }

      Okay, so you define a variable called $url but never use it, and instead reference a variable called $img_path ? Where is that defined?

      EDIT: Also, double check the variable for the destination as well; you defined $dest_file but never used that variable...

        Oh, thank you!
        I solved!
        $dst."test.jpg" worked at if(!@copy($url,$dst)) !

        =============================

        Thanks.

        I changed variables with quotes, and got same reult.

        $url = "http://www.test.com/conf/test.jpg";
        $dst = "./dst/file/data/thumb/";
        if(!@copy($url,$dst))
        {
        $errors= error_get_last();
        echo "COPY ERROR: ".$errors['type'];
        echo "<br />\n".$errors['message']."<br />\n";
        } else {
        echo "File copied from remote!";
        }

          Are you sure that this directory exists: ./dst/file/data/thumb/ ? Can you paste the exact full error message?

            Write a Reply...