reference/ftp/examples.xml
4d1c34c9b7a30cfc3a59641122c707a2812cfed7
...
...
@@ -12,13 +12,13 @@
12
12
<![CDATA[
13
13
<?php
14
14
// set up basic connection
15
-
$conn_id = ftp_connect($ftp_server);
15
+
$ftp = ftp_connect($ftp_server);
16
16

17
17
// login with username and password
18
-
$login_result = ftp_login($conn_id, $ftp_user_name, $ftp_user_pass);
18
+
$login_result = ftp_login($ftp, $ftp_user_name, $ftp_user_pass);
19
19

20
20
// check connection
21
-
if ((!$conn_id) || (!$login_result)) {
21
+
if ((!$ftp) || (!$login_result)) {
22
22
echo "FTP connection has failed!";
23
23
echo "Attempted to connect to $ftp_server for user $ftp_user_name";
24
24
exit;
...
...
@@ -27,7 +27,7 @@ if ((!$conn_id) || (!$login_result)) {
27
27
}
28
28

29
29
// upload the file
30
-
$upload = ftp_put($conn_id, $destination_file, $source_file, FTP_BINARY);
30
+
$upload = ftp_put($ftp, $destination_file, $source_file, FTP_BINARY);
31
31

32
32
// check upload status
33
33
if (!$upload) {
...
...
@@ -36,8 +36,8 @@ if (!$upload) {
36
36
echo "Uploaded $source_file to $ftp_server as $destination_file";
37
37
}
38
38

39
-
// close the FTP stream
40
-
ftp_close($conn_id);
39
+
// close the FTP connection
40
+
ftp_close($ftp);
41
41
?>
42
42
]]>
43
43
</programlisting>
44
44