ForgeComponents
en

Components

j-FileUploadList

jComponent 20 · jcomponent@20 component Example loaded with jComponent 20

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:

[
	{
		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.

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>