note 91933 added to function.ftp-put
| From: | bintjes at gmail dot com | Date: | Thu, 02 Jul 2009 08:51:47 +0000 |
| Subject: | note 91933 added to function.ftp-put | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-157799@lists.php.net to get a copy of this message | ||
I've seen two notes about a "ftp_copy" function but i think there's a
misinterpretation about what an "ftp_copy" function should do. For me , it should be
something like an ftp_rename that would keep the orginal file and clone it somewhere else on the
same ftp server, as for them they consider its purpose is to copy a local file to a distant ftp
..well .. as in FTP protocol there's no such thing as an FTP COPY command anyway, i think
you're free to interpret it as you want.
So here's my solution using ftp_put and ftp_get ..
bool ftp_copy ( resource $ftp_stream , string $initialpath, string $newpath, string $imagename )
function ftp_copy($conn_distant , $pathftp , $pathftpimg ,$img){
// on recupere l'image puis on la repose dans le nouveau folder
if(ftp_get($conn_distant, TEMPFOLDER.$img, $pathftp.'/'.$img ,FTP_BINARY)){
if(ftp_put($conn_distant, $pathftpimg.'/'.$img ,TEMPFOLDER.$img ,
FTP_BINARY)){
unlink(TEMPFOLDER.$img) ;
} else{
return false;
}
}else{
return false ;
}
return true ;
}
----
Server IP: 89.31.146.176
Probable Submitter: 195.248.4.144
----
Manual Page -- http://www.php.net/manual/en/function.ftp-put.php
Edit -- https://master.php.net/note/edit/91933
Del: integrated -- https://master.php.net/note/delete/91933/integrated
Del: useless -- https://master.php.net/note/delete/91933/useless
Del: bad code -- https://master.php.net/note/delete/91933/bad+code
Del: spam -- https://master.php.net/note/delete/91933/spam
Del: non-english -- https://master.php.net/note/delete/91933/non-english
Del: in docs -- https://master.php.net/note/delete/91933/in+docs
Del: other reasons-- https://master.php.net/note/delete/91933
Reject -- https://master.php.net/note/reject/91933
Search -- https://master.php.net/manage/user-notes.php