note 83604 added to function.copy
| From: | jean at onyxsa dot co dot za | Date: | Wed, 04 Jun 2008 08:57:04 +0000 |
| Subject: | note 83604 added to function.copy | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-140104@lists.php.net to get a copy of this message | ||
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 :)
----
Server IP: 69.147.83.197
Probable Submitter: 196.35.158.181 (proxied: 196.209.60.31)
----
Manual Page -- http://www.php.net/manual/en/function.copy.php
Edit -- https://master.php.net/note/edit/83604
Del: integrated -- https://master.php.net/note/delete/83604/integrated
Del: useless -- https://master.php.net/note/delete/83604/useless
Del: bad code -- https://master.php.net/note/delete/83604/bad+code
Del: spam -- https://master.php.net/note/delete/83604/spam
Del: non-english -- https://master.php.net/note/delete/83604/non-english
Del: in docs -- https://master.php.net/note/delete/83604/in+docs
Del: other reasons-- https://master.php.net/note/delete/83604
Reject -- https://master.php.net/note/reject/83604
Search -- https://master.php.net/manage/user-notes.php