The Box Content Uploader UI Element allows developers to embed an upload widget
in their desktop or mobile web application. Users can select files or use drag
and drop to upload. Large files will be uploaded with the Chunked
Upload API.
The UI Elements are designed in an authentication agnostic way so whether
you are using UI Elements for users who have Box accounts (Managed Users) or
non-Box accounts (App Users), UI Elements should work out of the box. The
reason for this is that UI Elements only expect a "token" to be passed in for
authentication, and Box provides two different ways to generate tokens - OAuth
and JWT.
These demos may not fully function until you provide a valid access token. For
testing purposes, you can use your temporary developer token. This will need
to be updated under the JS tab in the demo.
Box Folder ID. This will be the ID of the folder from which you want files to be uploaded to. If you want to use the Box All Files folder, then use 0 as the folderId.
accessToken
String
Box API access token to use. This should have upload access to the folder above. The value passed in for the token is assumed to never expire while the uploader is visible.
CSS selector of the container in which the content uploader should be placed. Calling hide() will clear out this container.
sharedLink
String
Shared link URL, required if folder is shared and the access token doesn't belong to an owner or collaborator of the file.
sharedLinkPassword
String
Shared link password, required if shared link has a password.
onClose
Function
Callback function for 'Close' button, which will appear when there are no files to upload or when all uploads are complete. If this option is not defined, the button will not appear.
modal
Object
When the modal attribute is specified, then the content uploader will not be created in-place. Instead a button will be created in the container and clicking this button will launch the content uploader in a modal popup. See below for the modal options.
size
String
undefined
Indicates to the content uploader to fit within a small or large width container. Value can be absent or one of small or large. If absent the UI Element will adapt to its container and automatically switch between small width or large width mode.
isTouch
Boolean
Defaults to the browser and device's default touch support
Indicates to the content explorer that it's is being rendered on a touch enabled device.
fileLimit
Number
100
The maximum number of files that can be uploaded at once. If more than fileLimit files are selected for upload, any beyond the first fileLimit files will not be included for uploaded. A warning message will be shown in the footer when this happens.
If your application requires the end user to only be able to access a subset of
the Content Explorer functionality, you can use Downscoping to
appropriately downscope the Access Token to a resulting token that has the
desired set of permissions, and can thus, be securely passed to the end user
client initializing the Content Explorer.
Below are a set of UI Element-specific scopes to go alongside Downscoping. These
allow developers to enable/disable UI controls on the Content Explorer by
configuring the appropriate scopes on the downscoped token. To learn
more, see Dedicated Scopes for Box UI Elements.