FilePicker

FilePicker

The FilePicker application renders contents of the server-side public directory This app allows for navigating and uploading files to the public path

Constructor

new FilePicker()

Source:

Members

(static) defaultOptions

Source:

(static) uploadURL

Source:

Return the upload URL to which the FilePicker should post uploaded files

activeSource :string

Source:

Track the active source tab which is being browsed

Type:
  • string

button :HTMLElement

Source:

A button which controls the display of the picker UI

Type:
  • HTMLElement

canUpload

Source:

Return a flag for whether the current user is able to upload file content

extensions :Array

Source:

The current set of file extensions which are being filtered upon

Type:

field :HTMLElement

Source:

The target HTML element this file picker is bound to

Type:
  • HTMLElement

request :string

Source:

The full requested path given by the user

Type:
  • string

source

Source:

Return the source object for the currently active source

sources :Object

Source:

The file sources which are available for browsing

Type:
  • Object

target

Source:

Return the target directory for the currently active source

title

Source:

type :String

Source:

The general file type which controls the set of extensions which will be accepted

Type:

Methods

(async, static) browse(source, target, options) → {Promise}

Source:

Browse files for a certain directory location

Parameters:
Name Type Description
source string

The source location in which to browse. See FilePicker#sources for details

target string

The target within the source location

options Object

Optional arguments

Properties
Name Type Description
bucket string

A bucket within which to search if using the S3 source

extensions Array

An Array of file extensions to filter on

wildcard boolean

The requested dir represents a wildcard path

Returns:

A Promise which resolves to the directories and files contained in the location

Type
Promise

(static) fromButton(button)

Source:

Bind the file picker to a new target field. Assumes the user will provide a

Parameters:
Name Type Description
button HTMLElement

The button element

(async, static) upload(source, path, file, options) → {Promise.<boolean>}

Source:

Dispatch a POST request to the server containing a directory path and a file to upload

Parameters:
Name Type Description
source string

The data source to which the file should be uploaded

path string

The destination path

file File

The File object to upload

options Object

Additional file upload options passed as form data

Returns:
Type
Promise.<boolean>

_inferCurrentDirectory(target) → {Array}

Source:

Given a current file path, determine the directory it belongs to

Parameters:
Name Type Description
target String

The currently requested target path

Returns:

An array of the inferred source and target path

Type
Array

_onChangeTab()

Source:

activateListeners(html)

Source:

Activate listeners to handle user interactivity for the FilePicker UI

Parameters:
Name Type Description
html

(async) browse(target, options)

Source:

Browse to a specific location for this FilePicker instance

Parameters:
Name Type Description
target string

The target within the currently active source location.

options Object

Browsing options

(async) getData()

Source:

render()

Source:

Additional actions performed when the file-picker UI is rendered