Welcome Guest, Not a member yet? Register   Sign In
FTP Issues
#1

[eluser]RockerBoy402[/eluser]
Hello. New here and still getting the hang of CI. I've ran into a small problem. I've extended the FTP library with an enhancement to download files via FTP instead of uploading them (I didn't change any code in Ftp.php, just put it in MY_Ftp.php). Anyways, below is the code I'm using. The issue is is that it is displaying the custom error using show_error() but when I take that out I do not get a PHP Error. Here is what I've got:

http://pastebin.com/PdvPNVkj

Each file starts at respective line:

Line 1: performance_data_push.php
Line 88: MY_Ftp.php
Line 285: console.php (view)

The error I'm getting is this:

Quote:An Error Was Encountered

Error downloading file.csv to junk/ from junk/. With error: The file was unable to be downloaded via FTP.

I've removed show_error() and still nothing. I'm at a loss at this point. Any help would be great!
#2

[eluser]anthrt[/eluser]
It won't show an error because you have suppressed the errors by using a @ at the start of this line:

Code:
$result = @ftp_get($this->conn_id, $loc_folder.'/'.$loc_filename, $rem_filename, $mode);
#3

[eluser]RockerBoy402[/eluser]
Thanks for the reply. That fixed my error issues, which turned out to be a PATH issue. I fixed that, or so it seems because it no longer shows a custom error or a PHP error. However, even though it all appears correct on the screen, I still get an E-Mail saying there was an error and the file is never actually downloaded to the local server. Here is the section of code I think might have the problem (also, the pastebin code should still display as I set it to never expire):

snippet from performance_data_push.php
Code:
if($this->ftp->download($rem_path, $loc_path))
        {
            return TRUE;
        }
        else
        {
            // Send out an E-Mail
            // ** See MY_email_helper.php to change recipient
            $this->load->helper('email');
            
            $error     = $this->ftp->get_error();
            $subject = "Error Pulling OpenX Data";
            $message = "There was an error pulling the OpenX Data from \"{$remote_path}\" to \"{$local_path}\"."
                . "\n\n\n"
                . "Data Dump\n\n"
                . "FTP Host: {$ftp_host}\n"
                . "FTP User: {$ftp_user}\n"
                . "FTP Pass: {$ftp_pass}\n"
                . "Filename: {$filename}\n";
            send_error_email($subject, $message);
            
            //show_error("Error downloading {$filename} to {$local_path} from {$remote_path}. With error: {$error}");
        }
        
        // Close the FTP Connection
        $this->ftp->close();

Thanks in advance!
#4

[eluser]anthrt[/eluser]
Shouldn't you echo out $error in that part to see the error you're getting?

Besides from that, I would try removing all of the instances where you've suppressed the errors (with @) but where you don't have custom error handling.
#5

[eluser]RockerBoy402[/eluser]
This solved it. I removed all the suppressors and was able to see a hidden error.
#6

[eluser]bretticus[/eluser]
I really hate all the PHP tutorials that show error suppressing. Suppressing errors is a fundamental mistake! If you don't want to see errors in your application, handle them. There are too many old tutorials out there showing the error control operator (@) in use. They do the PHP community a disservice. {okay, stepping off the soapbox now.}




Theme © iAndrew 2016 - Forum software by © MyBB