|
1 | | -## angular-filemanager API docs |
| 1 | +## angular-filemanager API docs [multiple file support] |
2 | 2 |
|
3 | 3 | #### Listing (URL: fileManagerConfig.listUrl, Method: POST) |
4 | 4 |
|
5 | 5 | **JSON Request content** |
6 | 6 | ```json |
7 | | -{ "params": { |
8 | | - "mode": "list", |
9 | | - "onlyFolders": false, |
| 7 | +{ |
| 8 | + "action": "list", |
10 | 9 | "path": "/public_html" |
11 | | -}} |
| 10 | +} |
12 | 11 | ``` |
13 | 12 | **JSON Response** |
14 | 13 | ```json |
15 | 14 | { "result": [ |
16 | 15 | { |
17 | | - "name": "joomla", |
18 | | - "rights": "drwxr-xr-x", |
19 | | - "size": "4096", |
20 | | - "date": "2015-04-29 09:04:24", |
21 | | - "type": "dir" |
22 | | - }, { |
23 | 16 | "name": "magento", |
24 | 17 | "rights": "drwxr-xr-x", |
25 | 18 | "size": "4096", |
26 | | - "date": "17:42", |
| 19 | + "date": "2016-03-03 15:31:40", |
27 | 20 | "type": "dir" |
28 | 21 | }, { |
29 | 22 | "name": "index.php", |
30 | 23 | "rights": "-rw-r--r--", |
31 | 24 | "size": "549923", |
32 | | - "date": "2013-11-01 11:44:13", |
| 25 | + "date": "2016-03-03 15:31:40", |
33 | 26 | "type": "file" |
34 | 27 | } |
35 | 28 | ]} |
36 | 29 | ``` |
37 | 30 | -------------------- |
38 | | -#### Rename / Move (URL: fileManagerConfig.renameUrl, Method: POST) |
| 31 | +#### Rename (URL: fileManagerConfig.renameUrl, Method: POST) |
39 | 32 | **JSON Request content** |
40 | 33 | ```json |
41 | | -{ "params": { |
42 | | - "mode": "rename", |
43 | | - "path": "/public_html/index.php", |
44 | | - "newPath": "/public_html/index2.php" |
45 | | -}} |
| 34 | +{ |
| 35 | + "action": "rename", |
| 36 | + "item": "/public_html/index.php", |
| 37 | + "newItemPath": "/public_html/index2.php" |
| 38 | +} |
| 39 | +``` |
| 40 | +**JSON Response** |
| 41 | +```json |
| 42 | +{ "result": { "success": true, "error": null } } |
| 43 | +``` |
| 44 | +-------------------- |
| 45 | +#### Move (URL: fileManagerConfig.moveUrl, Method: POST) |
| 46 | +**JSON Request content** |
| 47 | +```json |
| 48 | +{ |
| 49 | + "action": "move", |
| 50 | + "items": ["/public_html/libs", "/public_html/config.php"], |
| 51 | + "newPath": "/public_html/includes" |
| 52 | +} |
46 | 53 | ``` |
47 | 54 | **JSON Response** |
48 | 55 | ```json |
|
52 | 59 | #### Copy (URL: fileManagerConfig.copyUrl, Method: POST) |
53 | 60 | **JSON Request content** |
54 | 61 | ```json |
55 | | -{ "params": { |
56 | | - "mode": "copy", |
| 62 | +{ |
| 63 | + "action": "copy", |
57 | 64 | "path": "/public_html/index.php", |
58 | 65 | "newPath": "/public_html/index-copy.php" |
59 | | -}} |
| 66 | +} |
60 | 67 | ``` |
61 | 68 | **JSON Response** |
62 | 69 | ```json |
|
66 | 73 | #### Remove (URL: fileManagerConfig.removeUrl, Method: POST) |
67 | 74 | **JSON Request content** |
68 | 75 | ```json |
69 | | -{ "params": { |
70 | | - "mode": "delete", |
71 | | - "path": "/public_html/index.php", |
72 | | -}} |
| 76 | +{ |
| 77 | + "action": "remove", |
| 78 | + "items": ["/public_html/index.php"], |
| 79 | +} |
73 | 80 | ``` |
74 | 81 | **JSON Response** |
75 | 82 | ```json |
|
79 | 86 | #### Edit file (URL: fileManagerConfig.editUrl, Method: POST) |
80 | 87 | **JSON Request content** |
81 | 88 | ```json |
82 | | -{ "params": { |
83 | | - "mode": "savefile", |
84 | | - "content": "<?php echo random(); ?>", |
85 | | - "path": "/public_html/index.php", |
86 | | -}} |
| 89 | +{ |
| 90 | + "action": "edit", |
| 91 | + "item": "/public_html/index.php", |
| 92 | + "content": "<?php echo random(); ?>" |
| 93 | +} |
87 | 94 | ``` |
88 | 95 | **JSON Response** |
89 | 96 | ```json |
|
93 | 100 | #### Get content of a file (URL: fileManagerConfig.getContentUrl, Method: POST) |
94 | 101 | **JSON Request content** |
95 | 102 | ```json |
96 | | -{ "params": { |
97 | | - "mode": "editfile", |
98 | | - "path": "/public_html/index.php" |
99 | | -}} |
| 103 | +{ |
| 104 | + "action": "getContent", |
| 105 | + "item": "/public_html/index.php" |
| 106 | +} |
100 | 107 | ``` |
101 | 108 | **JSON Response** |
102 | 109 | ```json |
|
106 | 113 | #### Create folder (URL: fileManagerConfig.createFolderUrl, Method: POST) |
107 | 114 | **JSON Request content** |
108 | 115 | ```json |
109 | | -{ "params": { |
110 | | - "mode": "addfolder", |
111 | | - "name": "new-folder", |
112 | | - "path": "/public_html" |
113 | | -}} |
| 116 | +{ |
| 117 | + "action": "createFolder", |
| 118 | + "newPath": "/public_html/new-folder" |
| 119 | +} |
114 | 120 | ``` |
115 | 121 | **JSON Response** |
116 | 122 | ```json |
|
120 | 126 | #### Set permissions (URL: fileManagerConfig.permissionsUrl, Method: POST) |
121 | 127 | **JSON Request content** |
122 | 128 | ```json |
123 | | -{ "params": { |
124 | | - "mode": "changepermissions", |
125 | | - "path": "/public_html/index.php", |
| 129 | +{ |
| 130 | + "action": "changePermissions", |
| 131 | + "items": ["/public_html/root", "/public_html/index.php"], |
126 | 132 | "perms": "653", |
127 | 133 | "permsCode": "rw-r-x-wx", |
128 | | - "recursive": false |
129 | | -}} |
| 134 | + "recursive": true |
| 135 | +} |
130 | 136 | ``` |
131 | 137 | **JSON Response** |
132 | 138 | ```json |
|
136 | 142 | #### Compress file (URL: fileManagerConfig.compressUrl, Method: POST) |
137 | 143 | **JSON Request content** |
138 | 144 | ```json |
139 | | -{ "params": { |
140 | | - "mode": "compress", |
141 | | - "path": "/public_html/compressed.zip", |
142 | | - "destination": "/public_html/backups" |
| 145 | +{ |
| 146 | + "action": "compress", |
| 147 | + "items": ["/public_html/photos", "/public_html/docs"], |
| 148 | + "destination": "/public_html/backups", |
| 149 | + "compressedFilename": "random-files.zip" |
143 | 150 | }} |
144 | 151 | ``` |
145 | 152 | **JSON Response** |
|
150 | 157 | #### Extract file (URL: fileManagerConfig.extractUrl, Method: POST) |
151 | 158 | **JSON Request content** |
152 | 159 | ```json |
153 | | -{ "params": { |
154 | | - "mode": "extract", |
| 160 | +{ |
| 161 | + "action": "extract", |
155 | 162 | "destination": "/public_html/extracted-files", |
156 | | - "path": "/public_html/compressed.zip", |
157 | | - "sourceFile": "/public_html/compressed.zip" |
158 | | -}} |
| 163 | + "item": "/public_html/compressed.zip", |
| 164 | + "destination": "/public_html/extracteds/", |
| 165 | + "folderName": "latest" |
| 166 | +} |
159 | 167 | ``` |
160 | 168 | **JSON Response** |
161 | 169 | ```json |
@@ -187,10 +195,24 @@ $destination = $_POST['destination']; |
187 | 195 | $_FILES['file-0'] or foreach($_FILES) |
188 | 196 | ``` |
189 | 197 | -------------------- |
190 | | -#### Download / Preview file (URL: fileManagerConfig.downloadFileUrl, Method: GET) |
| 198 | +#### Download / Preview file (URL: fileManagerConfig.downloadMultipleUrl, Method: GET) |
191 | 199 | **Http query params** |
192 | 200 | ``` |
193 | | -[fileManagerConfig.downloadFileUrl]?mode=download&preview=true&path=/public_html/image.jpg |
| 201 | +[fileManagerConfig.downloadFileUrl]?action=download&path=/public_html/image.jpg |
| 202 | +``` |
| 203 | +**Response** |
| 204 | +``` |
| 205 | +-File content |
| 206 | +``` |
| 207 | +-------------------- |
| 208 | +#### Download multiples files in ZIP/TAR (URL: fileManagerConfig.downloadFileUrl, Method: GET) |
| 209 | +**JSON Request content** |
| 210 | +```json |
| 211 | +{ |
| 212 | + "action": "downloadMultiple", |
| 213 | + "items": ["/public_html/image1.jpg", "/public_html/image2.jpg"], |
| 214 | + "toFilename": "multiple-items.zip" |
| 215 | +}} |
194 | 216 | ``` |
195 | 217 | **Response** |
196 | 218 | ``` |
|
0 commit comments