FTP download
Posted: Fri Jan 18, 2013 6:12 am
I am facing a problem while downloading file from ftp.
my code is :
<?php
// define some variables
$local_file = 'd://my_file.sql';
$server_file = '/shared/abc.sql';
$ftp_server='ftp.xyz.net';
// set up basic connection
$conn_id = ftp_connect($ftp_server,21);
// login with username and password
$login_result = ftp_login($conn_id, 'abcd', '****');
ftp_pasv($conn_id,true);
// try to download $server_file and save to $local_file
if (ftp_get($conn_id, $local_file, $server_file, FTP_ASCII )) {
echo "Successfully written to $local_file";
} else {
echo "There was a problem";
}
// close the connection
ftp_close($conn_id);
?>
that showing the warning of:
Warning: ftp_get() [function.ftp-get]: Connection accepted in c:\wamp\www\sample.php on line 16
There was a problem
Note: the file contains 7 mb of size.... that full 7 mb being downloaded and still page loading suddenly showing this warning msg and the downloaded file gone....
Plz help?????
my code is :
<?php
// define some variables
$local_file = 'd://my_file.sql';
$server_file = '/shared/abc.sql';
$ftp_server='ftp.xyz.net';
// set up basic connection
$conn_id = ftp_connect($ftp_server,21);
// login with username and password
$login_result = ftp_login($conn_id, 'abcd', '****');
ftp_pasv($conn_id,true);
// try to download $server_file and save to $local_file
if (ftp_get($conn_id, $local_file, $server_file, FTP_ASCII )) {
echo "Successfully written to $local_file";
} else {
echo "There was a problem";
}
// close the connection
ftp_close($conn_id);
?>
that showing the warning of:
Warning: ftp_get() [function.ftp-get]: Connection accepted in c:\wamp\www\sample.php on line 16
There was a problem
Note: the file contains 7 mb of size.... that full 7 mb being downloaded and still page loading suddenly showing this warning msg and the downloaded file gone....
Plz help?????