View Single Post
Old 09-03-2010, 04:41 PM   #1 (permalink)
Arictos
The Wanderer
 
Join Date: Jul 2010
Posts: 17
Thanks: 0
Arictos is on a distinguished road
Default Issues with FTP_GET

I'm having a particularly interesting issue with the ftp_get function. The code I use in this example is:

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);    
    }
    
    if(
ftp_get($this->link$local_file$remote_file$mode))
    {
        return(
true);
    }
    
    return(
false);

The issue i'm having, is the file connection is solid, the file is downloaded properly, but the file ends up being empty. The file on the server is definitely populated with data, and is easily downloaded with a normal ftp client with all the data.

I've tried using both FTP_BINARY and FTP_ASCII, without a change in either. Any help would be appreciated.
Arictos is offline  
Reply With Quote