diff --git a/functions/ftp.xml b/functions/ftp.xml
index 81f1201151..651fe7c7b1 100644
--- a/functions/ftp.xml
+++ b/functions/ftp.xml
@@ -8,10 +8,43 @@
The following constants are defined when using the FTP module:
+ FTP_ASCII and FTP_BINARY.
+
+
+
+ ftp example
+
+<?php
+// set up basic connection
+$conn_id = ftp_connect("$ftp_server");
- FTP_ASCII, and
- FTP_BINARY.
+// login with username and password
+$login_result = ftp_login($conn_id, "$ftp_user_name", "$ftp_user_pass");
+// check connection
+if ((!$conn_id) || (!$login_result)) {
+ echo "Ftp connection has failed!";
+ echo "Attempted to connect to $ftp_server for user $user";
+ die;
+ } else {
+ echo "Connected to $ftp_server, for user $user";
+ }
+
+// upload the file
+$upload = ftp_put($conn_id, "$destination_file", "$source_file", FTP_BINARY);
+
+// check upload status
+if (!$upload) {
+ echo "Ftp upload has failed!";
+ } else {
+ echo "Uploaded $source_file to $ftp_server as $destination_file";
+ }
+
+// close the FTP stream
+ftp_quit($conn_id);
+?>
+
+
@@ -274,7 +307,9 @@
ftp_get retrieves remote_file
from the FTP server, and saves it to local_file
locally. The transfer mode specified must
- be either FTP_ASCII or FTP_BINARY.
+ be either FTP_ASCII or
+ FTP_BINARY.
+
@@ -326,8 +361,9 @@
ftp_put stores local_file
on the FTP server, as remote_file. The transfer
- mode specified must be either FTP_ASCII or
- FTP_BINARY.
+ mode specified must be either
+ FTP_ASCII or FTP_BINARY.
+
@@ -353,8 +389,9 @@
ftp_fput uploads the data from the file pointer
fp until end of file. The results are stored
in remote_file on the FTP server. The transfer
- mode specified must be either FTP_ASCII or
- FTP_BINARY.
+ mode specified must be either
+ FTP_ASCII or FTP_BINARY
+
@@ -430,7 +467,9 @@
Returns true on success, false on error.
ftp_rename renames the file specified
- by from to the new name to
+ by from to the new name
+ to
+
@@ -452,7 +491,8 @@
Returns true on success, false on error.
ftp_delete deletes the file specified by
- path from the FTP server.
+ path from the FTP server.
+
@@ -495,7 +535,8 @@
- ftp_connect closes ftp_stream.
+ ftp_connect closes ftp_stream.
+