View Single Post
Old 02-18-2012, 10:16 PM   #5 (permalink)
AxelG
The Wanderer
 
AxelG's Avatar
 
Join Date: Feb 2012
Posts: 16
Thanks: 0
AxelG is on a distinguished road
Default

Your file is empty because you do not have open it

PHP Code:
/**
 * Downloads a file from the ftp server and saves it to a file
 * 
 * @var        string        Local file that you wish to write to
 * @var        string        Remote file to process contents from
 * @var        integer        FTP Mode
 * @var        bool        Returns true on sucess, or false of failure
 */
public function get($local_file$remote_file$mode FTP_BINARY)
{
    if(
is_file($local_file))
    {
        
unlink($local_file);    
    }
    
$stream = @fopen($local_file'wb');
    if (!
$stream) {
        echo(
"Cannot open file: $local_file");
        return(
false);
    }
    
$download ftp_get($this->link$stream$remote_file$mode);
    
fclose($stream);
    if(
$download)
    {
        return(
true);
    }
    return(
false);

AxelG is offline  
Reply With Quote