# j-Upload

> Il componente può eseguire il caricamento di file.

Framework: jcomponent20
Product: jComponent 20 (jcomponent@20)
Language: it
Content-SHA256: 0035be75ac1a00877af4591bbae8738ec48c8ede79984c8d6cdd02c3bce2b255
Snapshot: c0700e321579725c5cf4f5ace1ad7d2866d1b4f93c24a63c0b41b6b7998e976c
Sources: components@910ed1a86f6e72b4f031d3ad0dc7844f9fc5cb8e
Review: not-recorded

Il componente può eseguire __upload dei file__.

- Facile e universale utilizzo
- singolo

__Metodi__:

```javascript
var opt = {};

// Restricts files according to the content-type
// opt.accept = 'image/*';

// Enables multiple files
// opt.multiple = true;

// IMPORTANT:
// URL address for uploading
opt.url = '/api/upload/';

// A callback
opt.callback = function(response) {

};

opt.error = function(err) {
	// Optional
	// Error handling
};

// Optional, additional request data
opt.data = {};
opt.data.fieldName1 = 'value';
opt.data.fieldName2 = 'value';

// Shows file browser
SETTER('upload/show', opt);
```

I file vengono caricati con questi nomi/chiari nel modulo `file1`, `file2`, `file..N`.

Utilizzare con `<ui-component name="upload">`Quando il componente non è ancora caricato, jComponent Scarica il codice in prima utilizzazione dall'indirizzo `DEF.fallback` (Il Componentator La storia di Peter Širka.Fonte: il Componentator Ristorante dei componenti, licenza MIT.

```html example.html
<ui-component name="upload"></ui-component>
<br />
<a href="javascript:uploadfile()">Upload file</a>

<script>
	function uploadfile() {

		var opt = {};

		opt.url = '/api/upload/files/';
		opt.accept = 'image/*';
		opt.multiple = true;
		opt.callback = function(response) {
			console.log(response);
		};
		// opt.error = function(err) {};

        SETTER('upload/show', opt);
    }
</script>
```
