# j-FileUploadList

> This component can upload files and the result adds into the model. Model must be the array.

Framework: jcomponent20
Product: jComponent 20 (jcomponent@20)
Language: en
Content-SHA256: 5ce004b5f58d35be3b8f602313b8706c516c6198990dedce7b766351dbb9dda1
Snapshot: c0700e321579725c5cf4f5ace1ad7d2866d1b4f93c24a63c0b41b6b7998e976c
Sources: components@910ed1a86f6e72b4f031d3ad0dc7844f9fc5cb8e
Review: not-recorded

This component can upload files and the result adds into the model. Model must be the `array`.

__Configuration__:

- `url` {String} URL to upload (default: `/api/upload/`)
- `accept` {String} Optional, a content type for filtering files e.g. `image/*`
- `multiple` {Boolean} Optional, enables multiple files uploading (default: `true`)
- `progress` {String} a path to `function(percentage)`
- `text` {String} a key name for rendering of `text` value (default: `name`)

__Model__:

Server must return `Array` in the form below:

```javascript
[
	{
		name: String,
		length: Number,
		url: String
	}
]
```

Use it with `<ui-component name="fileuploadlist">`. When the component is not loaded yet, jComponent downloads it on first use from the address in `DEF.fallback` (the Componentator CDN by default). Author: Peter Širka. Source: the Componentator components repository, MIT license.

```html example.html
<ui-component name="fileuploadlist" path="files"></ui-component>
<br />
<div><a href="javascript:browsefiles()">Upload files</a></div>

<script>
	var files = [];
	files.push({ name: 'repeater.html', length: 2676, url: '/download/16753-1467713967-repeater.html' });
	files.push({ name: 'snapshot.js', length: 507, url: '/download/16754-168632909-snapshot.js'});
	files.push({ name: 'tracking-cms.gif', length: 974730, url: '/download/16755-1806731401-tracking-cms.gif' });

	function browsefiles() {
		SETTER('fileuploadlist', 'browse');
	}
</script>
```
