Re: ftp_put Problems
| From: | Marek Kilimajer | Date: | Sat, 25 Sep 2004 22:16:31 +0000 |
| Subject: | Re: ftp_put Problems | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-197837@lists.php.net to get a copy of this message | ||
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);