|
@@ 527-549 (lines=23) @@
|
| 524 |
|
return $exists; |
| 525 |
|
} |
| 526 |
|
|
| 527 |
|
function fget($fp, $remotefile,$rest=0) { |
| 528 |
|
if($this->_can_restore and $rest!=0) fseek($fp, $rest); |
| 529 |
|
$pi=pathinfo($remotefile); |
| 530 |
|
if($this->_type==FTP_ASCII or ($this->_type==FTP_AUTOASCII and in_array(strtoupper($pi["extension"]), $this->AutoAsciiExt))) $mode=FTP_ASCII; |
| 531 |
|
else $mode=FTP_BINARY; |
| 532 |
|
if(!$this->_data_prepare($mode)) { |
| 533 |
|
return FALSE; |
| 534 |
|
} |
| 535 |
|
if($this->_can_restore and $rest!=0) $this->restore($rest); |
| 536 |
|
if(!$this->_exec("RETR ".$remotefile, "get")) { |
| 537 |
|
$this->_data_close(); |
| 538 |
|
return FALSE; |
| 539 |
|
} |
| 540 |
|
if(!$this->_checkCode()) { |
| 541 |
|
$this->_data_close(); |
| 542 |
|
return FALSE; |
| 543 |
|
} |
| 544 |
|
$out=$this->_data_read($mode, $fp); |
| 545 |
|
$this->_data_close(); |
| 546 |
|
if(!$this->_readmsg()) return FALSE; |
| 547 |
|
if(!$this->_checkCode()) return FALSE; |
| 548 |
|
return $out; |
| 549 |
|
} |
| 550 |
|
|
| 551 |
|
function get($remotefile, $localfile=NULL, $rest=0) { |
| 552 |
|
if(is_null($localfile)) $localfile=$remotefile; |
|
@@ 586-608 (lines=23) @@
|
| 583 |
|
return $out; |
| 584 |
|
} |
| 585 |
|
|
| 586 |
|
function fput($remotefile, $fp) { |
| 587 |
|
if($this->_can_restore and $rest!=0) fseek($fp, $rest); |
| 588 |
|
$pi=pathinfo($remotefile); |
| 589 |
|
if($this->_type==FTP_ASCII or ($this->_type==FTP_AUTOASCII and in_array(strtoupper($pi["extension"]), $this->AutoAsciiExt))) $mode=FTP_ASCII; |
| 590 |
|
else $mode=FTP_BINARY; |
| 591 |
|
if(!$this->_data_prepare($mode)) { |
| 592 |
|
return FALSE; |
| 593 |
|
} |
| 594 |
|
if($this->_can_restore and $rest!=0) $this->restore($rest); |
| 595 |
|
if(!$this->_exec("STOR ".$remotefile, "put")) { |
| 596 |
|
$this->_data_close(); |
| 597 |
|
return FALSE; |
| 598 |
|
} |
| 599 |
|
if(!$this->_checkCode()) { |
| 600 |
|
$this->_data_close(); |
| 601 |
|
return FALSE; |
| 602 |
|
} |
| 603 |
|
$ret=$this->_data_write($mode, $fp); |
| 604 |
|
$this->_data_close(); |
| 605 |
|
if(!$this->_readmsg()) return FALSE; |
| 606 |
|
if(!$this->_checkCode()) return FALSE; |
| 607 |
|
return $ret; |
| 608 |
|
} |
| 609 |
|
|
| 610 |
|
function put($localfile, $remotefile=NULL, $rest=0) { |
| 611 |
|
if(is_null($remotefile)) $remotefile=$localfile; |