# dhtmlxconnector:file_system [DHX documentation]

DHTMLX Docs & Samples Explorer

Index
dhtmlxconnector
Usage Guide

### Using File System as datasource

Connector 1.x allows to use FileSystem as datasouce. It can be used with any client side component, but more common use-case is the grid and tree

    	require("./codebase/connector/db_filesystem.php");
    	require("./codebase/connector/grid_connector.php");

    	$grid = new GridConnector("", "FileSystem");
    	$grid->render_table("../","safe_name","filename,full_filename,size,name,extention,date,is_folder");

Above code will fill grid with info about files in d:/www folder

Parameters of render_table

- folder, for which data listing is required

- id field, leave it empty of use safe_name as ID of file

- list of fields, possible values are

- filename - name of file

- full_filename - full path to file

- size - size of file in bytes

- name - name part of file name

- extension - extension part of file name

- date - timestamp of file

- is_folder - file|folder flag

##### Limiting files in output

You can limit files by extension type

    	$fileTypes = FileSystemTypes::getInstance();
    	$fileTypes->addExtention('png');

or by meta-type

    	$fileTypes = FileSystemTypes::getInstance();
    	$fileTypes->setType('web');

- image - image files
- document - doc, xls, txt, rtf
- web - php, html, js, css
- audio - mp3, wav, ogg
- video - avi, mpg, mpeg, mp4
- only_dir - folders

or by regexp pattern

    	$fileTypes = FileSystemTypes::getInstance();
    	$fileTypes->addPattern('/^.+\..*$/');