PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!
Moderator: General Moderators
php3ch0
Forum Contributor
Posts: 212 Joined: Sun Nov 13, 2005 7:35 am
Location: Folkestone, Kent, UK
Post
by php3ch0 » Wed Oct 31, 2007 4:55 am
I am having a problem with uploading a file via ftp to google base.
I keep getting the error:
Warning: ftp_login() expects parameter 1 to be resource, boolean given in /home/l/a/laptopcentre/public_html/fulladmin/froogle.php on line 329
Warning: ftp_pasv() expects parameter 1 to be resource, boolean given in /home/l/a/laptopcentre/public_html/fulladmin/froogle.php on line 330
code is as follows
Code: Select all
// ...some code
$conn_id = ftp_connect($ftp_server);
ftp_pasv($conn_id, true);
// login with username and password
$login_result = ftp_login($conn_id, $ftp_user_name, $ftp_password);
// some more code ...
where $ftp_server = uploads.google.com
and username and password are correct as I can connect using my ftp program.
Please help
xitura
Forum Newbie
Posts: 20 Joined: Fri Sep 07, 2007 11:25 am
Post
by xitura » Wed Oct 31, 2007 6:09 am
ftp_pasv returns a boolean, that's why you get that error message. You need to connect first and then turn passive mode on. Just as it says in the example for ftp_pasv on php.net
php3ch0
Forum Contributor
Posts: 212 Joined: Sun Nov 13, 2005 7:35 am
Location: Folkestone, Kent, UK
Post
by php3ch0 » Wed Oct 31, 2007 7:45 am
ok i have changed the code so i log in first then change to pasv mode
Code: Select all
$conn_id = ftp_connect($ftp_server);
$login_result = ftp_login($conn_id, $ftp_user_name, $ftp_password);
ftp_pasv($conn_id, true);
still getting this message
Warning: ftp_login() expects parameter 1 to be resource, boolean given in /home/l/a/laptopcentre/public_html/fulladmin/froogle.php on line 329
Warning: ftp_pasv() expects parameter 1 to be resource, boolean given in /home/l/a/laptopcentre/public_html/fulladmin/froogle.php on line 330
xitura
Forum Newbie
Posts: 20 Joined: Fri Sep 07, 2007 11:25 am
Post
by xitura » Wed Oct 31, 2007 10:33 am
ftp_connect returns FALSE on error, please add or die("Couldn't connect to $ftp_server"); to the end of the first line to see if the connection is failing.
php3ch0
Forum Contributor
Posts: 212 Joined: Sun Nov 13, 2005 7:35 am
Location: Folkestone, Kent, UK
Post
by php3ch0 » Wed Oct 31, 2007 10:47 am
yes getting error could not connect to uploads.google.com
xitura
Forum Newbie
Posts: 20 Joined: Fri Sep 07, 2007 11:25 am
Post
by xitura » Wed Oct 31, 2007 10:53 am
Try changing uploads.google.com to ftp.uploads.google.com