jvrothjr Posted January 16, 2007 Share Posted January 16, 2007 I have a script that I am having trouble with.The FTP user works and the program can get the file size just can't download file. PleaseHelp.here is the code I am having trouble with and the error msg.[code=php:0]function getfile($file,$fp,$conn_id) {// Host Server include('http://rcchjr.awardspace.com/ftpsetting.inc');// 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); // get the size of $file $res = ftp_size($conn_id, $file); if ($res != -1) { echo "size of $file is $res bytes</p>";// Initate the download $ret = ftp_nb_fget($conn_id, $fp, $file, FTP_ASCII); while ($ret == FTP_MOREDATA) { // Do whatever you want echo "."; // Continue downloading... $ret = ftp_nb_continue($conn_id); } if ($ret != FTP_FINISHED) { echo "There was an error downloading file $file</p>"; unlink($fp); } } else { echo "couldn't get the size</p>"; }// close the connection ftp_close($conn_id); }[/code]Error Msg:[code=php:0]size of rc/rcabout.php is 3283 bytesThere was an error downloading file rc/rcabout.php[/code]The code is basiclly right from the php manual.......I can login with the ID and manually download the file...... Link to comment https://forums.phpfreaks.com/topic/34478-ftp_nb_fget-help/ Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.