-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.php
More file actions
71 lines (43 loc) · 1.44 KB
/
index.php
File metadata and controls
71 lines (43 loc) · 1.44 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
<?php
# Step 6
// *** Define your host, username, and password
define('FTP_HOST', '192.168.1.88');
define('FTP_USER', 'Blimpf');
define('FTP_PASS', 'catfish');
// *** Include the class
include('ftp_class.php');
// *** Create the FTP object
$ftpObj = new FTPClient();
// *** Connect
if ($ftpObj -> connect(FTP_HOST, FTP_USER, FTP_PASS)) {
## --------------------------------------------------------
# Step 7
$dir = 'httpdocs/photos';
// *** Make directory
$ftpObj->makeDir($dir);
print_r($ftpObj -> getMessages());
## --------------------------------------------------------
# Step 8
$fileFrom = 'zoe.jpg';
$fileTo = $dir . '/' . $fileFrom;
// *** Upload local file to new directory on server
$ftpObj -> uploadFile($fileFrom, $fileTo);
print_r($ftpObj -> getMessages());
## --------------------------------------------------------
# Step 9
// *** Change to folder
$ftpObj->changeDir($dir);
// *** Get folder contents
$contentsArray = $ftpObj->getDirListing();
// *** Output our array of folder contents
echo '<pre>';
print_r($contentsArray);
echo '</pre>';
## --------------------------------------------------------
# Step 10
$fileFrom = 'zoe.jpg'; # The location on the server
$fileTo = 'zoe-new.jpg'; # Local dir to save to
// *** Download file
$ftpObj->downloadFile($fileFrom, $fileTo);
}
?>