ForgeKomponenty
cs

Komponenty

j-DragDropFiles

jComponent 20 · jcomponent@20 component Příklad načten s jComponent 20

Konfigurace:

  • exec {String} - složka provádí tuto metodu, pokud jsou soubory vymazány
  • class {String} - třída toggles v případě, že je vypuštěna
  • click {Boolean} - způsobuje otevřený dialog souboru, když uživatel klikne na prvek (předvolené: true)
  • accept {String} - změna akceptovat atribut, např. pouze akceptujte pdfs nastavených na application/pdf (předvolený: */*)

Použijte ji s <ui-component name="dragdropfiles">Pokud je součástka ještě nezačleněna, jComponent Stáhnout ji na první použití z adresy DEF.fallback a) The Componentator CDN dle předvolby. autor: Peter Širka. zdroj: Componentator Výrobce je autorizován, MIT licence.

example.html
<ui-component name="dragdropfiles" path="null" config="exec:dragdropfiles_files;accept:application/pdf;">
	<span>Drag &amp; Drop files here</span>
</ui-component>

<script>
	function dragdropfiles_files(files, evt) {
		console.log(files);
		/*

		var data = new FormData();
		for (var i = 0, length = files.length; i < length; i++)
			data.append('file' + i, files[i]);

		UPLOAD('/api/upload/', data, function(response) {
			console.log(response);
		});

		*/
	}
</script>