| ChrisR |
01-08-2009 08:47 AM |
ftp_fget error help.
I am getting this error here is the lines of code for it.
Quote:
Warning: fopen(data.zip) [function.fopen]: failed to open stream: Permission denied in /home/admin/*****/*****/update.php on line 75
Warning: ftp_fget() expects parameter 2 to be resource, boolean given in /home/admin/*****/*****/update.php on line 84
There was a problem while downloading sw_0.11.zip to data.zip
Warning: fclose(): supplied argument is not a valid stream resource in /home/admin/*****/*****/update.php on line 92
|
line 75 starts at $handle.
PHP Code:
$remote_file = "sw_{$version}.zip";
$local_file = "data.zip";
$ftp_server = "***.**.***.***";
$ftp_user_name = "**************";
$ftp_user_pass = "***************";
// open some file to write to
$handle = fopen($local_file, 'w');
// set up basic connection
$conn_id = ftp_connect($ftp_server);
// login with username and password
$login_result = ftp_login($conn_id, $ftp_user_name, $ftp_user_pass);
// try to download $remote_file and save it to $handle
if (ftp_fget($conn_id, $handle, $remote_file, FTP_ASCII, 0)) {
echo "successfully written to $local_file\n";
} else {
echo "There was a problem while downloading $remote_file to $local_file\n";
}
// close the connection and the file handler
ftp_close($conn_id);
fclose($handle);
|