Re: ftp_put Problems

From: Date: Sat, 25 Sep 2004 22:38:07 +0000
Subject: Re: ftp_put Problems
References: 1 2  Groups: php.general 
Request: Send a blank email to php-general+get-197838@lists.php.net to get a copy of this message
Maybe I should be more specific about what I am trying to do. I may be way off base in my approach. I want to upload using ftp a file from my local c drive (c:\somefile.text) to my server. I have been trying the ftp_put function example in the manual and it is failing. It reports "There was a problem uploading the file." Any suggestions would be greatly appreciated. Thanks, Julian "Marek Kilimajer" <lists@kilimajer.net> wrote in message news:4155EE3F.8090707@kilimajer.net... > Julian wrote: >> Hello, >> >> I need to use FTP to upload a local file to a server. The uploads must be >> done through FTP and not HTTP. Unfortunately, the example in the manual >> is not working for me. If someone has any suggestions I would really >> appreciate it. > > Not much information. There is not error checking in the example, try this > and tell us the output: > > $file = 'somefile.txt'; > $remote_file = 'readme.txt'; > > // set up basic connection > $conn_id = ftp_connect($ftp_server); > > if(!$conn_id) die("Could not open connection to $ftp_server"); > > // login with username and password > $login_result = ftp_login($conn_id, $ftp_user_name, $ftp_user_pass); > > if(!$login_result) die("Could not login as user $ftp_user_name"); > > // upload a file > if (ftp_put($conn_id, $remote_file, $file, FTP_ASCII)) { > echo "successfully uploaded $file\n"; > } else { > echo "There was a problem while uploading $file\n"; > } > > // close the connection > ftp_close($conn_id);

« previous php.general (#197838) next »