Roxy Fileman custom server side scripts

Roxy Fileman server side scripts could be written in any server programming language. Here is detailed description of all parameters sent and responses expected by the Roxy Fileman user interface.

List directory tree

This script should send the entire directory tree, beginning with the root directory (set via "FILES_ROOT" setting). The response is an array of objects, e.g.

[
{"p":"root_dir", "f":"3", "d":"2"},
{"p":"root_dir/dir1", "f":"2", "d":"0"},
{"p":"root_dir/dir2", "f":"5", "d":"1"},
{"p":"root_dir/dir2/subdir1", "f":"9", "d":"0"}
]

In order to minimize the data transferred the object properties are only one letter long.
Properties:
p - path of the directory - absolute to the document root
f - the number of files in the directory
d - number of subdirectories in the directory

List files in a directory

Parameters:
d - path of the directory to list, e.g. /path/images
type - the type (NOT the extension) of the files to be included in the list. This is the parameter sent to the file browser when opened. it could be anything you need for your implementation. If your using CKEditor or TinyMCE this will be "image", "flash" or "files".

This script should send list of the files in the directory filtered by type. The response is an array of objects, e.g.

[
{"p":"/path/file1.jpg", "s":"5884", "t":"1390779016", "w":"800", "h":"600"},
{"p":"/path/file2.doc", "s":"187374", "t":"1390779016", "w":"0", "h":"0"},
{"p":"/path/file3.txt", "s":"5848", "t":"1390779016", "w":"0", "h":"0"},
{"p":"/path/file4.png", "s":"487885", "t":"1390779016", "w":"500", "h":"300"}
]

In order to minimize the data transferred the object properties are only one letter long.
Properties:
p - path of the file - absolute to the document root
s - file size in bytes
t - modification time of the file - unix timestamp
w - if the file is image, the width of the image
h - if the file is image, the height of the image

Copying directory

Parameters *:
d - full path to directory to be copy, e.g. /path/dir_name
n - full path of the new directory, e.g. /new_path/dir_name

Response: standard **

Copying file

Parameters *:
f - full path of the file to copy, e.g. /path/file_name.ext
n - directory path where the file should copied, e.g. /new_path

Response: standard **

Create directory

Parameters *:
d - directory path where the new directory should be created, e.g. /path1/path2
n - the name of the new directory, e.g. new_dir_name

Response: standard **

Delete directory

Parameters *:
d - directory path to be deleted

Response: standard **

Download file

Parameters *:
f - the path of the file to be downloaded

Response: Set headers to force download and output the file.

Move directory

Parameters *:
d - path of the directory to move, e.g. /old_path/dir_name
n - target path without the original directory name, e.g. /new_path

Response: standard **

Move file

Parameters *:
f - path of the file to move, e.g. /old_path/file_name.ext
n - target file path, e.g. /new_path/file_name.ext

Response: standard **

Rename directory

Parameters *:
d - path of the directory to rename, e.g. /path/dir_name
n - target path without the original directory name, e.g. new_dir_name

Response: standard **

Move file

Parameters *:
f - path of the file to rename, e.g. /path/file_name.ext
n - new file name, e.g. new_file_name.ext

Response: standard **

Generate thumbnail

Parameters *:
f - path of the image file to generate thumbnail from, e.g. /path/file_name.jpg
width - width of the thumbnail
height - height of the thumbnail

Note: you will probably need to crop images.

Response: standard **

Upload files

Parameters:
These parameters are sent via POST!
d - directory path where the files should be uploaded to, e.g. /uploads/path
files - array of uploaded files. The name of the field in the upload form is "files[]".

Response: standard **
 

* Parameters are sent via POST request.

** Standard response is in JSON format and contains either

{"res":"ok", "msg":""}

  in case of success or

{"res":"error", "msg":"This is the error displayed to the user"}

in case of error.