note 83604 deleted from function.copy by yannick
| From: | yannick@php.net | Date: | Wed, 04 Jun 2008 09:18:13 +0000 |
| Subject: | note 83604 deleted from function.copy by yannick | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-140105@lists.php.net to get a copy of this message | ||
Note Submitter: jean at onyxsa dot co dot za
Reason: bad code
----
Hmmm.... im having a lil trouble, i want to use the copy() to download/copy files from weblinks.
this is what i have:
[CODE]
function strip($link) {
$larray = explode("/",$link);
$i = count($larray);
$filename = $larray[$i-1];
return($filename);
}
$text = "Enter link here";
if(isset($_POST['btngetme'])) {
$link = $_POST['txtlink'];
trim($link);
$filename = strip($link);
if(!copy($link,"./downloads/".$filename)) {
$text = "Unable to copy file";
} else {
$text = "File started downloading successfully!";
}
}
[/CODE]
but it keeps comming up with this error:
"Warning: copy(www.test.com/test.test) [function.copy]: failed to open stream: No such file or
directory in C:\wamp\www\dm\index.php on line 9"
the www.test.com/test.test is an example, i have tried using this on files from websites i KNOW
exist. any help would be greatly appreciated :)