ForgeComponents
en

Components

j-FileUpload

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

Is very helpful component for uploading e.g. profile photos. I consider this component as inline file upload. Look into the html source. The component uploads files via multipart/form-data.

Configuration:

  • url {String} a target URL for the uploading
  • accept {String} (optional) can contain a content-type frow browsing files e.g. image/*
  • multiple enables multiple files upload (default: false)
  • array {Boolean} enables pushing an uploaded value to array (path must be the array)
  • label {String} (optional) changes a current innerHTML (default: innerHTML)
  • disabled {Boolean} disables

Friendly components:

This component works with loading (when the file is uploading) and message (when server throws an error) component.

Use it with <ui-component name="fileupload">. 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
<a href="javascript:void(0)"><ui-component name="fileupload" path="mypicture" config="url:/my-upload-url/">Upload</ui-component></a>

<script>
	var mypicture = '';
</script>